Cloudflare APO vs nginx caching is a question that comes up the moment a WordPress site gets slow enough to notice. Both layers cache pages, both cut load on your origin, and both can serve a page without touching PHP. Running both sounds like double protection. In practice, two cache layers only help when each one has a clear job and a clear purge path. Stack them blindly and you get stale pages, logged-in users seeing the wrong content, and a purge button that clears one layer while the other keeps serving the old page.
The short answer: for most small WordPress sites on a cheap VPS, pick one layer to do the heavy lifting and let the other play a supporting role. APO usually wins when your traffic is spread across countries and your origin is small. Nginx caching wins when you want full control, no extra subscription, and a cache that works even if Cloudflare is bypassed. Running both makes sense only in a specific setup, which this guide spells out.
Cloudflare APO vs nginx caching: how each layer works
Automatic Platform Optimization, or APO, caches your WordPress HTML at Cloudflare’s edge. A visitor in another country gets the page from a nearby data center instead of waiting for your VPS to run PHP and query MySQL. The official Cloudflare WordPress plugin ties APO to your site: when you publish or update a post, it tells Cloudflare to purge the changed URLs. APO is a paid add-on on the free plan, so check official pricing before you commit to it.
Nginx server-side caching works one step closer to home. With FastCGI cache, nginx stores the HTML output of PHP-FPM on disk the first time a page is requested, then serves that stored copy to the next visitor without running PHP again. Nothing leaves your server, nothing depends on a third-party dashboard, and the cache survives even when a request bypasses Cloudflare. If you want the full setup, our walkthrough on how to configure nginx FastCGI cache for WordPress without a plugin covers the zone, the bypass rules, and the purge setup step by step.
The difference that matters is not speed in a lab test. It is who controls the purge. APO purges from the WordPress plugin. Nginx cache purges from your server, usually through a helper plugin or a manual purge URL. When both layers cache the same page, an update has to clear both, or visitors keep seeing the old version from whichever layer you forgot.
What APO caches, and what it skips
APO caches HTML for anonymous visitors. It skips logged-in users, cart and checkout pages on WooCommerce sites, and requests carrying certain cookies, because serving a cached admin bar or someone else’s cart to a stranger is a real bug, not a minor glitch. It also respects the bypass rules you set: pages with query strings used for previews and admin screens stay dynamic.
APO also changes how you think about page rules. On the free plan, a Cache Everything page rule can approximate part of what APO does, but it lacks the WordPress-aware purging, so edited posts can sit stale until the edge TTL expires. Before APO existed, the usual workaround was a hand-built set of cloudflare apo page rules, and that gap in purging is exactly why many site owners moved to APO, as covered in our guide to speeding up WordPress with Cloudflare APO and page rules.
APO only helps traffic that passes through Cloudflare. Direct-to-origin requests skip the edge entirely, which is why origin caching keeps its place even on APO sites.
What nginx FastCGI cache does on your VPS
FastCGI cache stores rendered pages on your server’s disk and serves them from nginx before PHP-FPM wakes up. The nginx fastcgi cache wordpress configuration below is a common starting point, and server-side caching wordpress setups live or die by the skip rules that come after it:
fastcgi_cache_path /var/cache/nginx levels=1:2
keys_zone=WORDPRESS:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout updating;
add_header X-FastCGI-Cache $upstream_cache_status;
The bypass rules matter more than the cache path. You skip the cache for POST requests, query strings, logged-in cookies, and admin URLs:
set $skip_cache 0;
if ($request_method = POST) { set $skip_cache 1; }
if ($query_string != "") { set $skip_cache 1; }
if ($http_cookie ~* "wordpress_logged_in") { set $skip_cache 1; }
if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php") { set $skip_cache 1; }
Then you wire those variables into the location block with fastcgi_cache_bypass $skip_cache; and fastcgi_no_cache $skip_cache;. Without them, nginx caches a logged-in dashboard page and serves it to the next anonymous visitor, which accounts for most “my cache shows the wrong user” reports.
Disk use stays modest on small sites, and the inactive=60m setting drops pages nobody requested in the last hour, so the cache cleans itself. For the wider TTFB picture, see our guide to reducing WordPress TTFB below 200 ms on a cheap VPS.
Side-by-side comparison
| Aspect | Cloudflare APO | Nginx FastCGI cache |
|---|---|---|
| Where pages are cached | Cloudflare edge data centers worldwide | Disk on your own VPS |
| What it caches | HTML for anonymous visitors, plus static assets | HTML output of PHP-FPM, per your cache key |
| Purge trigger | WordPress plugin purges on publish or update | Helper plugin, purge module, or manual cache clear |
| Logged-in visitors | Bypassed automatically via cookie rules | Bypassed only if you write the skip rules |
| Traffic that skips it | Direct-to-origin requests and Cloudflare outages | Requests that bypass nginx, which is rare on a standard stack |
| Recurring cost | Paid add-on on the free plan (check official pricing) | None beyond your existing VPS |
| Setup difficulty | Plugin install plus a few dashboard toggles | Manual nginx config and testing |
| Failure mode | Stale edge copy after a missed purge | Wrong-user content if skip rules are missing |
Read the table as a trade, not a scorecard. APO buys geographic reach and a managed purge path. Nginx caching buys independence and control.
When running both actually works
Both layers can coexist if you assign them different jobs. The clean version: nginx FastCGI cache guards the origin, and APO serves the edge. A request that misses the edge still hits a warm nginx cache instead of PHP, so your VPS stays calm during traffic spikes and during the minutes after an APO purge. Purges must clear both layers on publish, so use the WordPress plugin for APO and a cache-purge plugin for the origin layer, then test an edit end to end: change a post, check the page from a fresh browser session, and confirm the new version appears.
Both layers also make sense when your audience is global and your origin is small. A 1 GB VPS serving a worldwide audience benefits from edge caching in a way a local audience never notices, while the origin cache keeps the VPS alive when a post gets shared and the edge cache is cold. Before you add APO to a stack that already caches at the origin, weigh whether you need the paid plan at all; our comparison of Cloudflare Pro vs free, and whether the paid plan is worth it, covers the wider plan question.
When one layer is enough
Skip APO if your audience sits in one country near your VPS, your traffic is modest, and nginx FastCGI cache already serves pages fast. The edge adds little when the origin is already a short network hop away, and every extra layer is one more purge path to maintain.
Skip nginx caching if you dislike editing nginx config, your host panel already manages caching, or your site changes constantly with logged-in traffic, such as a membership site or a busy WooCommerce store. On those sites the cache hit rate drops, the bypass rules grow, and APO plus object caching gives you more benefit with less config to babysit.
Never run two layers with two different TTLs and no purge plan. A page that lives 30 days at the edge and one hour at the origin will confuse you the first time an urgent correction takes a day to appear. Set both TTLs short while you test, verify purges work, then lengthen them once you trust the setup.
Checklist before you stack them
- Confirm anonymous visitors get cached pages and logged-in users never do, on both layers.
- Publish a test edit and verify it appears from a fresh session within a minute.
- Check the
X-FastCGI-Cacheheader and the Cloudflarecf-cache-statusheader to see which layer served the page. - Exclude cart, checkout, account, and admin URLs from both caches.
- Write down the purge steps for each layer so a future edit at midnight does not turn into guesswork.
Pick the layer that matches your traffic and your tolerance for config work, add the second only when it has a job the first cannot do, and test purges before you trust either one. A cache you cannot purge on demand is a liability, not an optimization.