location ~ [^/]\.php(/|$) {try_files $uri =404;fastcgi_passunix:/tmp/php-cgi-81.sock;fastcgi_index index.php;include fastcgi.conf; #新增的缓存规则fastcgi_cache_bypass $skip_cache;fastcgi_no_cache $skip_cache;add_hea
fastcgi_cache_bypass $skip_cache;fastcgi_no_cache $skip_cache;add_headerX-Cache"$upstream_cache_status From $host";fastcgi_cacheWORDPRESS;add_header Cache-Control max-age=0;add_header Nginx-Cache"$upstream_cache_status";add_header Last-Modified $date_gmt;add_headerX-Frame-OptionsSAMEORIGIN;# ...
同一个服务器的多个网站都开启 Nginx fastcgi_cache 缓存 就在已添加的 Nginx 配置基础上,再加一行代码,为第二个网站设置不同的 fastcgi_cache_path 路径和 keys_zone 名称(大写),比如,可将第二个网站 fastcgi_cache_path 设置为/tmp/wpcache2将 keys_zone 设置为lsposed 网站 配置 复制第一个网站的缓存配置...
location~[^/]\.php(/|$){try_files $uri=404;fastcgi_pass unix:/tmp/php-cgi.sock;fastcgi_index index.php;include fastcgi.conf;#新增的缓存规则 fastcgi_cache_bypass $skip_cache;fastcgi_no_cache $skip_cache;add_headerX-Cache"$upstream_cache_status From $host";fastcgi_cache blog;fastcgi_cach...
FastCGI_cache是Nginx的缓存模块,能够从Nginx层面实现网页静态化,有效提高网站的并发能力、减少PHP运行时间和请求响应时间,大大提升页面加载速度。Fastcgi_cache能够直接在nginx层面提供缓存内容,而无需涉及PHP或WordPress,在没有第三方广告情况下加速效果很不错!网上不少此教程,但是没分开缓存pc端与移动端,经过折腾实现了...
一、安装Nginx ngx_cache_purge模块 具体安装ngx_cache_purge模块教程可以去 vpsrr.com/lnmp-install- 看看。 这里特别提醒下,对照lnmp的版本,路径和参数稍微有点不一样。 二、WordPress开启nginx fastcgi_cache缓存配置实例 这里贴出xianba.net的Nginx开启fastcgi_cache缓存配置实例,说明如下: fastcgi_cache_path /ho...
include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_cache_bypass $skip_cache; fastcgi_no_cache $skip_cache; fastcgi_cache WORDPRESS; fastcgi_cache_valid 60m; } location ~ /purge(/.*) { fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1"; ...
④安装 WordPress 插件:Nginx Helper 使用FastCGI_Cache 产生的缓存是不会自己更新清除的,需要配合插件清除过期的缓存。 安装后配置如下: ⑤查看是否正常工作 上面我们为了方便查看是否正常工作加了一个 header 现在我们只要打开开发者工具查看一下页面相应头部即可: ...
fastcgi_cache_valid2003013021d; } #缓存清理配置 location~/purge(/.*){ allow127.0.0.1; allow"服务器外网IP";# 引号要保留 deny all; fastcgi_cache_purge WORDPRESS"$scheme$request_method$host$1"; } 添加好之后,重载Nginx设置,缓存就加好了。
,比如,例如:第二个网站 fastcgi_cache_path 设置为 /tmp/wpcache2 将 keys_zone 设置为 WORDPRESS...