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/$1/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/$1/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头,表示命中了缓存
}
下面是我的配置:

1.本网站资源来源于网络收集,如有侵权,请联系站长进行删除处理。请发送邮件至:chensi2024@foxmail.com,我们将第一时间处理!
2.资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需。
3.所有资源仅限于参考和学习,版权归原作者所有,更多请阅读网站声明。
4.如下载链接失效,请在当前页留言或私信管理员,24小时必处理结束!
5.本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解。
6.本站提供的资源仅限用于学习交流和研究目的。不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负,我们不保证内容的长久可用性,通过使用本站内容随之而来的风险以及产生法律纠纷与本站无关,您必须在下载后的24个小时之内,从您的电脑/手机中彻底删除。


