LEMP with WordPress and W3 Total Cache not caching static files.


Following the relevant tutorials on DigitalOcean I have managed to properly install a LEMP stack + WordPress (/usr/share/nginx/html). I’ve updated to PHP 5.5.9 and nginx to 1.4.6. My WordPress website is running fine.

I use W3 Total Cache for the page caching, minifying (with APCu) and browser cache. However, when I’m running google pagespeed or “curl -I” command on a static resource it all says it isn’t cached.

Browser caching for HTML seems to be working (“curl -I”):

HTTP/1.1 200 OK Server: nginx/1.4.6 Date: Thu, 20 Mar 2014 17:19:43 GMT Content-Type: text/html; charset=UTF-8 Connection: keep-alive Last-Modified: Thu, 20 Mar 2014 17:18:12 GMT Expires: Fri, 21 Mar 2014 17:18:12 GMT Pragma: public Cache-Control: max-age=86309, public, must-revalidate, proxy-revalidate Etag: 3e5fe98d138e488a20e4d8bed073aa72 X-Powered-By: W3 Total Cache/0.9.3 Vary: X-Pingback:

But not for a static resources (“curl -I”):

HTTP/1.1 200 OK Server: nginx/1.4.6 Date: Thu, 20 Mar 2014 17:22:56 GMT Content-Type: image/gif Content-Length: 14692 Last-Modified: Thu, 20 Mar 2014 16:18:44 GMT Connection: keep-alive ETag: “532b14e4-3964” Accept-Ranges: bytes

I created a nginx.conf file (in the root directory where WordPress is installed) where I have manually added the lines from the “install” tab in W3 Total Cache.

My apologies if this is a stupid question, I am new to this. Any help is greatly appreciated.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

if your WP version is 3.8.1, then W3 Total Cache doesn’t work with it. <br> <br>I tried that 2 weeks ago and had the same issue. if you use WP v.3.8, however, it will function without any issue. <br> <br>

@wzy: Thank you, that actually fixed it! <br> <br>@daniellekwint: I immediately turned it of and. Do you mean never use minify or never use minify with APCu? I would like what is the reason for this is? <br> <br>Thank you!

minifying (with APCu) never do this !