上一期,我们讲到《wordpress性能优化方案 全面提升wordpress打开速度》。其中一项是如何使用Cachify插件,来提高wordpress网站的速度。
Cachify插件使用方法
配置方法:
配置方法非常简单,这里缓存方式推荐使用Mencached。(使用的前提需求服务器安装Mencached,参考教程:【wordpress建站,如何对服务器进行优化?】)
伪静态规则:
插件内选项配置好之后,需要在 Nginx 站点伪静态中 添加下边的规则。
然后重启Nginx 服务,即可生效。
location ~ / {
error_page 404 405 = @nocache;
if ( $query_string ) {
return 405;
}
if ( $request_method = POST ) {
return 405;
}
if ( $request_uri ~ "/wp-" ) {
return 405;
}
if ( $http_cookie ~ (wp-postpass|wordpress_logged_in|comment_author)_ ) {
return 405;
}
default_type text/html;
add_header X-Powered-By Cachify;
set $memcached_key $host$uri;
memcached_pass localhost:11211;
}
location @nocache {
try_files $uri $uri/ /index.php?$args;
}
查看方法:
Cachify插件下载地址:
夸克:https://pan.quark.cn/s/0f87cf0c7b04
迅雷:https://pan.xunlei.com/s/VOefUJ91Nk4q1tULmHFzztFSA1?pwd=xymk#
当然,针对wordpress网站性能的优化,远不止这些,为了提高wordpress的打开速度,你还需要进行下面几项优化: