WordPress强化速度:启用Memcached对象存储、插件Super Static Cache缓存内容

WordPress的两个强化速度方式: 一、启用Memcached对象存储(适合内存大的主机) 1、在PHP中其中Memcached功能。 2、下载 object-cache.php.tar.gz,解压后放到 wp-content 目录下。 二、启用缓存插件Super Static Cache 1、下载Super Static Cache插件,WP后台安装、启用。 2、在Super Static Cache中选择 Rewrite模式,这样就会在网站根目录下生成 super-static-cache 文件夹,所有的缓存文件会存在这个文件夹中。 3、伪静态增加如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#BEGIN Super Static Cache
location / {

if (-f $request_filename) {
break;
}
if ($uri ~ /(.*)$){
set $wpuri $1;
set $sscfile $document_root/super-static-cache/$1;
}
set $ssc Y;
if ($query_string !~ .*=.*){
set $ssc "${ssc}Y";
}
if ($request_method != "POST"){
set $ssc "${ssc}Y";
}

if (-f $sscfile){
set $ssc "${ssc}F";
}
if (-f $sscfile/index.html){
set $ssc "${ssc}I";
}

if ($ssc = YYYF){
rewrite . /super-static-cache/$wpuri break;
}
if ($ssc = YYYI){
rewrite . /super-static-cache/$wpuri/index.html break;
}

if (!-e $request_filename){
rewrite . /index.php last;
}
}
#End Super Static Cache

4、作者说明页:https://www.hitoy.org/super-static-cache-for-wordperss.html 三、CDN缓存 在CDN处增加缓存文件后缀 .gz,可进一步增加访问速度。