WordPress缓存插件Comet Cache体验和Nginx设置

提到WordPress缓存插件我们可能看到较多的是WP Super Cache。其实还有很多不错的缓存插件值得我们使用。本站最近在着手整理网友博客中提到的一些所谓他们认为不错的WordPress缓存插件,然后一个个体验后看看到底如何。其中一款是原来 叫做ZenCache的插件,目前改名叫做Comet Cache。

本站简单体验后发现Comet Cache插件缓存的文件直接在目录中是以HTML形式存在的,相对比WP Super Cache生成的PHP缓存文件应该更缓存一点点。这里本站在测试安装和看看如何使用。

第一、Comet Cache插件安装

Comet Cache插件地址:https://wordpress.org/plugins/comet-cache/

可以直接从后台搜索后下载启动。

第二、Comet Cache激活设置

如果我们要求不高,或者不是特别明白直接同意启动就可以。如果我们需要单独的设置可以看到有如下功能。

我们可以看到自定义设置缓存目录、过期时间、各种请求设置。如果我们不懂,那就直接默认。

第三、Nginx配置设置

如果我们使用的是Nginx机制,那需要在配置文件中添加下面缓存脚本。

server {

etag on; expires 7d; if_modified_since before;

gzip on; gzip_vary on; gzip_comp_level 6; gzip_types text/plain text/xml image/svg+xml # text/html in core already. application/rss+xml application/atom+xml application/xhtml+xml text/css application/json application/x-javascript application/font-otf application/font-ttf;

# Do not allow public access to private cache directory. if ($uri ~* /wp\\-content/cache/comet\\-cache/cache(?:/|$)) { return 403; } # Do not allow public access to private cache directory. if ($uri ~* /wp\\-content/cache/comet\\-cache/htmlc/private(?:/|$)) { return 403; }

location ~* \\.(?:ttf|ttc|otf|eot|woff|woff2|css|js)$ { add_header Access-Control-Allow-Origin *; }

location ~* \\.php$ { fastcgi_param WP_NGINX_CONFIG done; } }

如果是Nginx,我们需要手工设置将中间的部分添加到对应的server{}文件脚本中。

最后,启动之后我们就可以自动运行缓存机制的WP网站。Comet Cache也是有付费功能的,付费功能会功能多一些,一般我们免费足够。

推荐站内搜索:域名备案流程、国内站群服务器宽带ip地址查询、外贸空间、美国asp空间、香港ip、香港云服务器、美国服务器、ip地址、美国多ip站群vps、