W3 Total Cache (W3TC) is one of the oldest and most configurable WordPress caching plugins. It handles page caching, object caching, database caching, browser caching, minification and CDN integration. On a VPS, where you control Nginx and can run Redis, it can make WordPress very fast. But its many options also make it easy to misconfigure. This guide gives sensible settings.

Before you start

  • Use one caching plugin only. Deactivate WP Super Cache, WP Rocket, LiteSpeed Cache and others first.
  • Install Redis and the PHP extension (recommended for the object cache):
sudo apt install -y redis-server php8.3-redis
sudo systemctl restart php8.3-fpm

See install Redis.

wp plugin install w3-total-cache --activate

General settings (Performance → General Settings)

Feature Setting Why
Page Cache ON, method Disk: Enhanced Serves static HTML files; with Nginx rules, PHP is skipped entirely
Minify OFF at first Can break layouts; enable later and test
Opcode Cache Leave to PHP (OPcache) Configure OPcache in php.ini
Database Cache OFF (or Redis, if testing shows a gain) MySQL’s own caching plus the object cache usually suffice
Object Cache ON, method Redis Biggest win for logged-in users and WooCommerce
Browser Cache ON Long expiry headers for static files
CDN Only if you use one See below

Save, then check the plugin’s “Compatibility Check” for missing modules.

Nginx rules for Disk: Enhanced

On Apache, W3TC writes .htaccess rules automatically. On Nginx, it writes the rules to an nginx.conf file in your site root. You must include that file in your server block:

server {
    server_name example.com;
    root /var/www/example.com;
    include /var/www/example.com/nginx.conf;   # W3TC rules
    # … rest of your WordPress config
}
sudo nginx -t && sudo systemctl reload nginx

Make sure the PHP user can write that file (W3TC updates it when settings change), and reload Nginx after changing W3TC settings. Without the include, Disk: Enhanced still works, but every request goes through PHP first. See the ideal Nginx config for WordPress.

Alternative: use Redis as the page cache method (simpler on Nginx, slightly slower), or Nginx FastCGI cache with W3TC handling only the object cache. See Nginx FastCGI cache.

Page cache settings

Performance → Page Cache:

  • Cache front page, feeds, SSL requests: ON.
  • Don’t cache pages for logged-in users: ON.
  • Cache preload: enable, with your sitemap URL, so pages are warm after purges.
  • Purge policy: front page, post page, and blog feed on update. Defaults are reasonable.
  • Never cache: WooCommerce cart, checkout and my-account (W3TC detects WooCommerce, but double-check), plus any custom dynamic pages.

Object cache with Redis

Performance → Object Cache: Redis server 127.0.0.1:6379, database 0 (use different databases or key prefixes if several sites share one Redis). Test with the button provided. Then check under Performance → Dashboard that the hit rate is climbing.

Browser cache

Defaults are good: Expires headers, Cache-Control, and gzip. Leave “Set ETag” on. If you already configured expires in Nginx for static files, avoid conflicting rules. See Nginx static file caching.

Minify (optional, test carefully)

Combining and minifying CSS/JS can break themes, and brings less benefit with HTTP/2. If you try it:

  • Use manual mode, and add files gradually.
  • Test menus, sliders, forms and checkout after each change.
  • If the theme breaks, disable minify. Image optimization and good caching matter more.

CDN

Performance → CDN: choose “Generic Mirror” (pull CDN) with your CDN hostname, or the integration for your provider. Only static files (wp-content, wp-includes) should be rewritten. See WordPress CDN setup.

Verify

curl -sI https://example.com/ | grep -iE 'cache|x-powered'
curl -s https://example.com/ | tail -n 5     # W3TC adds an HTML comment with cache details

The footer comment shows “Page Caching using Disk: Enhanced” and timing details. Test as a logged-out visitor.

Troubleshooting

Problem Fix
Changes don’t appear Performance → Purge All Caches; check the CDN cache
Layout broken Disable minify
Logged-in content shown to visitors Check “Don’t cache pages for logged-in users”; exclude dynamic pages
Nginx rules not applied Include nginx.conf in the server block; reload Nginx
Redis errors Check systemctl status redis-server and the PHP extension

Quick reference

Layer Recommended
Page cache Disk: Enhanced + Nginx include (or FastCGI cache)
Object cache Redis
Database cache Off (usually)
Browser cache On
Minify Off, or manual + careful testing

Related: LiteSpeed Cache and WP Rocket alternatives.

  • WordPress
  • Performance
  • Caching