Report this

What is the reason for this report?

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

Posted on March 20, 2014

Hello,

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://ukuscales.com/”):

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: http://ukuscales.com/xmlrpc.php

But not for a static resources (“curl -I http://ukuscales.com/wp-content/themes/ut/images/vivalaukuleledrawn.gif”):

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.



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!

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.

minifying (with APCu) never do this !

How about adding this… ? <br> <br># Cache Static Files For As Long As Possible <br>location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { <br> access_log off; <br> log_not_found off; <br> expires max; <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!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.