智能摘要 DeepSeek
WP Super Cache是一款高效的WordPress缓存插件,通过生成静态HTML文件显著提升了网站加载速度和服务器负载压力。它支持页面压缩、CDN加速、移动设备缓存,且可自定义缓存时间及频率。配置方法包括:1)通过插件后台搜索或官网下载安装;2)启用插件后,进入设置勾选高级选项;3)预加载设置可选0分钟,但需注意文章数量及主机情况;4)在伪静态规则中插入预加载缓存代码。该插件适合WordPress用户提升网站性能。
WP Super Cache 是一款老牌的WordPress 缓存插件 ,它可以把整个网页直接生成静态 html文件,让你的网站不需要再花时间运行 PHP 代码、数据库查询上,大大降低了对服务器的负载压力,从而达到显著的提速。之前看某篇文章对比目前几款静态缓存插件 WP Rocket, W3 Total Cache, WP Super Cache, WP Fastest Cache, Comet Cache, 和 Cache Enabler.,综合评测来说,个人比较倾向使用 WP Super Cache 。
WP Super Cache 特点:页面压缩和动态缓存;支持内容交付网络(CDN);亦可以让单独设置使用移动设备访问网站的用户访问缓存页面;可以自定义调整插件在给定的时间间隔管理删除和重新缓存。非常的人性化。网络上有许多教程讲解如何配置 WP Super Cache 的选项,但貌似都是旧版本居多,因此,水一贴讲解一下我个人使用 WP Super Cache 的配置方案。
插件使用方法:
1、通过 WordPress 后台插件中,可以搜索:WP Super Cache ,找到这个插件。或者前往官网:WP Super Cache 下载。
2、安装完成,启用插件,进入后台 – 设置,在最下面找到:WP Super Cache,如下图:

3、设置高级选项,启用缓存,按下图勾选各项。具体每个设置项目为什么勾选就不一一阐述了。


4、预加载设置
预缓存页面如下操作,选择0分钟,即不刷新预缓存文件。如果博客文章太多,刷新频繁时会影响系统性能。尤其是虚拟主机不建议这样做。
立即预加载缓存这个按钮酌情考虑,如果你文章不是很多,空间又足够大,那么可以尝试。

5、把下列代码插入到伪静态规则中,这里以宝塔为例
set $cache_uri $request_uri;
# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
set $cache_uri 'null cache';
}
if ($query_string != "") {
set $cache_uri 'null cache';
}
# Don't cache uris containing the following segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
set $cache_uri 'null cache';
}
# Don't use the cache for logged in users or recent commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
set $cache_uri 'null cache';
}
location / {
try_files /wp-content/cache/supercache/$host/$cache_uri/index-https.html $uri $uri/ /index.php?$args ;
}

📮评论