yum
upgrades for production use, this is the repository for you.
Active subscription is required.
WP Super Cache is one of the most popular WordPress plugins for Full Page Caching.
It is not the silver bullet of FPC, however, because it does not leverage Varnish.
If you still want to use WP Super Cache for some reason, you must set it up properly.
To set this plugin to work correctly with NGINX is not a trivial task, especially because many misguides are available online, giving incorrect configurations and wrong advice.
Correct NGINX configuration for WP Super Cache
server {
# ...
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/$http_host/$cache_uri/index-https.html $uri $uri/ /index.php$is_args$args;
}
}
The most important part of our NGINX configuration for WP Super Cache is passing on $is_args$args
.
Some guides online bluntly and wrongfully mention that passing request arguments will break WP Super Cache.
This is not only incorrect. Moreover, not passing arguments will break the proper operation of any plugin that relies on request arguments.
WP Super Cache works fine with either the plugins relying on query parameters, or not relying on those. It just won’t “supercache” them. In other words, there will be no static files created for more efficient caching.