Caching is the single biggest speed improvement for most WordPress sites. Without it, every page view runs PHP and dozens of database queries. With it, most visitors get a ready-made HTML page in milliseconds. On your own VPS you can cache at the server level or with a plugin, and the best choice depends on your web server. Here’s how the main options compare.
The layers of WordPress caching
| Layer | What it caches | Examples |
|---|---|---|
| Page cache | Full HTML pages for anonymous visitors | LiteSpeed Cache, WP Rocket, Nginx FastCGI cache, Varnish |
| Object cache | Database query results across requests | Redis, Memcached |
| Opcode cache | Compiled PHP | OPcache (enable it always) |
| Browser / CDN cache | Static files (images, CSS, JS) | Cache headers, a CDN |
A full setup uses all four. The page cache gives the biggest win for content sites. The object cache matters most for logged-in users, WooCommerce and admin speed. See WordPress Redis object cache.
Page cache plugins
| Plugin | Price | Best with | Highlights |
|---|---|---|---|
| LiteSpeed Cache | Free | LiteSpeed / OpenLiteSpeed servers | Server-level page cache (very fast), image optimisation, CSS/JS optimisation, object cache support |
| WP Rocket | Paid | Any server | Easiest setup, sensible defaults, preloading, file optimisation, delay JS |
| W3 Total Cache | Free (+ Pro) | Any server, advanced users | Many options (page, object, database, browser cache, CDN). Easy to misconfigure |
| WP Super Cache | Free | Any server | Simple static HTML cache from Automattic |
| Cache Enabler | Free | Any server | Lightweight static cache |
LiteSpeed Cache: if you run (Open)LiteSpeed
LiteSpeed Cache stores pages in the web server itself, with smart purging when content changes, and ESI for partial caching (WooCommerce carts). On OpenLiteSpeed or LiteSpeed Enterprise, it’s usually the best option, and it’s free. On Nginx or Apache, its page cache doesn’t work (other features still do). See OpenLiteSpeed.
WP Rocket: easiest everywhere
Works on any server, with good results out of the box. Its file optimisation features (minify, combine, defer or delay JavaScript, lazy loading) help Core Web Vitals. A paid licence.
W3 Total Cache and WP Super Cache
Free and capable. W3TC is powerful, but enabling every option (minify, database cache to disk) can slow a site or break it. Enable features one at a time, and test. WP Super Cache is simpler and reliable.
Server-level caching (Nginx)
On a Nginx VPS, Nginx FastCGI cache serves cached pages without touching PHP at all. It’s extremely fast, and needs only configuration plus a purge mechanism (a purge plugin like Nginx Helper, or short TTLs):
fastcgi_cache_path /var/cache/nginx/wp levels=1:2 keys_zone=WP:100m inactive=60m;
# in the PHP location:
fastcgi_cache WP;
fastcgi_cache_valid 200 301 302 60m;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
Skip cache for logged-in users, carts, checkout and POST requests. Full setup: Nginx FastCGI cache. Varnish is another server-side option. See Varnish.
Recommendations by setup
| Your stack | Recommended |
|---|---|
| OpenLiteSpeed / LiteSpeed | LiteSpeed Cache plugin + Redis object cache |
| Nginx (LEMP) | Nginx FastCGI cache (+ Nginx Helper for purging), or WP Rocket, + Redis |
| Apache | WP Rocket or WP Super Cache, + Redis |
| WooCommerce | Any of the above, with cart, checkout and account pages excluded, + Redis object cache |
| Behind Cloudflare | Server cache plus Cloudflare for static assets (or APO for full-page edge caching) |
Pitfalls
- Two page caches at once (e.g. a plugin and Nginx FastCGI cache) cause stale pages and debugging headaches. Pick one.
- Caching personalised pages: carts, account pages and anything with user-specific content must be excluded. WooCommerce plugins handle this. Check custom pages.
- Minify and combine can break JavaScript. Test after enabling, and exclude problem scripts.
- Object cache without Redis on the server, using disk instead, can be slower than no object cache.
- Not purging after updates: configure purge on post or theme updates, and clear caches after plugin changes.
Measure the result
curl -sI https://example.com | grep -iE 'x-cache|x-litespeed-cache|x-fastcgi-cache|cf-cache-status'
curl -o /dev/null -s -w 'TTFB: %{time_starttransfer}\n' https://example.com
A cached page should show a HIT header, and a TTFB well under 200 ms from nearby locations. See Core Web Vitals and server speed and WordPress on a VPS.
Related: website speed optimization and WordPress memory limit.