当我们安装主题和插件时,都会向…
WP Fastest Cache,最简单和最快速的WP缓存系统。

1、本身是免费的,后台直接搜索 WP Fastest Cache,安装即可。
2、配合WP Fastest Cache高级版:wp-fastest-cache-premium使用!
3、WP Fastest Cache配置Nginx,实现真正的静态化
下面的配置可以使你的WP Fastest Cache达到真正的完全静态,(甚至PHP进程挂掉,网站依旧能正常运行)
location / {
# 如果请求的文件已存在,直接返回
if (-f $request_filename) {
break;
}
set $caches 1; #是否缓存
set $request_file $document_uri; #获取请求文件
set $cache_file ''; #缓存文件
#请求方式是POST的不拦截
if ($request_method = POST) {
set $caches 0;
}
#包含GET请求参数的不拦截(访问量高可以注释掉)
if ($query_string) {
set $caches 0;
}
# 指定静态缓存文件的路径
if ($caches = 0) {
set $request_file '';
}
if ($request_file ~ ^(.+)$) {
set $cache_file /wp-content/cache/all/\/index.html; #你的WP Fastest Cache缓存目录
}
# 命中缓存
if (-f $document_root$cache_file) {
rewrite ^ $cache_file last;
}
# 无法命中缓存,转给WordPress来处理
if (!-e $request_filename) {
rewrite . /index.php last; 接着看看,你的网站打开速度是不是快了好多好多。
下面这个是无注释版,可直接使用在宝塔面板上。
location / {
if (-f $request_filename) {
break;
}
set $caches 1;
set $request_file $document_uri;
set $cache_file '';
if ($request_method = POST) {
set $caches 0;
}
if ($query_string) {
set $caches 0;
}
if ($caches = 0) {
set $request_file '';
}
if ($request_file ~ ^(.+)$) {
set $cache_file /wp-content/cache/all/\/index.html;
}
if (-f $document_root$cache_file) {
rewrite ^ $cache_file last;
}
if (!-e $request_filename) {
rewrite . /index.php last;
}
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent; 如果想在header中检测是否生效了,就添加下面的代码:
location /wp-content/cache/all/ { #这一行是你的WP Fastest Cache缓存文件路径
add_header Cache HIT; #添加header头,表示命中了缓存
} 下面是我的配置:


微信扫描二维码联系我们!
我们在微信上24小时期待你的声音
提供外贸路由器设备产品,轻松翻墙,解答:WP主题推荐,WP网站建设,Google SEO,百度SEO,专业服务器环境搭建等!
需要提供WordPress主题/插件的汉化服务可以随时联系我们!另外成品WordPress网站以及半成品WordPress网站建设,海外Google SEO优化托管服务,百度SEO优化托管服务,Centos/Debian服务器WP专用环境搭建,WP缓存服务器搭建,我们都是你的首选,拥有多年WP开源程序服务经验,我们一直在坚持客户体验,没有最好,只有更好!