The Right way to use Cloudflare Cache Everything with WordPress



You can read issues here


Which Cache plugin are you using? If it is LiteSpeed server, I believe you can use W3TC also!

(Serdar) #38

I was using Litespeed cache plugin on my shared hosting. But now I migrated my blog (under construction) to the nginx webserver. (DigitalOcean)

W3TC is a great plugin. However it is not fully compatible with Nginx unfortunately. There are combining issues for css&js files. And If you select ‘’ add Cache Headers ‘’ and ‘’ add Expires Headers ‘’ on W3TC, It caused duplicated cache-control headers issue. I emailed the developers.

Also I was using a contact form which calls admin-ajax.php on my Litespeed server. This contact form plugin is not working with Nginx. why I don’t know. The issue is related to php-nginx configuration I think.

Litespeed or Nginx which one is faster than others I don’t know but Litespeed is easy to use really. Its cache plugin (LSCache) is the best plugin ever I think.


First question is, why do you combine? :confused:

(Serdar) #40

I combined all css&js files which are called on every page. And also, other I excluded css&js files which are called for special pages like comment-reply.js or contact-form.css

For example,

  • I combined these; style.css, bootstrap.css, theme-name.js (because these are called on every page)
  • I excluded these; comment-reply.min.js, contact-form.js

So browser cache is working well because combined files is loaded on every page.

(DND) #41

If you are going to use CF Cache everything … then origin server choice will not make any differnce … as you are running WP Dashboard only on your server … rest pages are served from cache only

(Serdar) #42

So do you recommend ‘’ don’t use any cache plugin, just use CF cache everything’’ in this situation? right?


There is advantage of having two layer of cache, in order reduce server load while serving MISS response.

  • Suppose homepage is cached by Cloudflare and W3TC
  • Request from previously cached location X, the response will be cf-cache-status: HIT
  • For the new location Y, the response will be cf-cache-status: MISS - At this point, W3TC cache would be helpful.

(DND) #44

Well, I was saying something else :stuck_out_tongue: I was saying you should have not changed your origin server to Nginx or to digital ocean … as running WP Dashbord is not a hectic for a shared server … and Litespeed is really good …

So if you could find any plugin which can purge CF Caches perfectly …

  • Post updates
  • Comment posted
  • Widget updates

then you can select any server …

(Serdar) #45

Yes I agree with you after thinking it. Also we can use some multi-regional pagespeed tests in order to wake up cache on other POPs :slight_smile: I will research it :slight_smile:


I have done research for the same, and currently there is no plugin better than W3TC which does this job.

(DND) #47

W3TC purges CF cache when New Comment is Posted ?


Yes, you can warm cache globally with manual speed test at

Note: Cache is subject to expire anytime. Practically, it’s not possible to do this everytime.

Currently, no automated way. If you spot, please let me know.


Yes. W3TC has Cloudflare extention which take care of purge cache of Cloudflare edge as neccessary.


W3TC works perfectly fine for me on the NGINX. You may have missed some PHP modules while installing …
I would recommend following this complete guide

(Serdar) #51

I installed WP Multisite with W3TC by following your guide (LEMP). The developers said ‘’ Nginx and W3TC are working well on multisite ‘’.

Other functions of multi-site and Wordpress are working great. The issue is related to only W3TC or php I guess…


Sorry, my guide is not intend for Multisite WordPress. It’s for single WordPress application, managed by specific NGINX server block one by one.

Also, I have not tested W3TC for multisite, so don’t know how its work there.

(Serdar) #53

Nginx recommend these conf for multisite;

# Add support for subdirectory structure in WordPress Multisite
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.) $2 last;
rewrite ^(/[^/]+)?(/.
.php) $2 last;

And also I added these too for W3TC:
W3 Total Cache Plugin
include /var/www/html/nginx.conf;

Your guide is really good and secure. No problem for that. Thanks!

(Serdar) #54

The last thing is that bro, I’m wondering we have VPS and why we use Disk caching for database cache?

In this situation, using memcached for database cache is not good option for you?


Yes, it’s better to use if host support.