Expires .. is there a way to set an expires header for all of jpg, gif, css, js ?

David mishy.cth at gmail.com
Sat Sep 6 21:55:36 MSD 2008

Hi Rob,

I've managed to get this working now:

        Location ~* ^.+\.(jpg|jpeg|gif|png)$ {
            access_log        off;
            expires           30d;

I needed to specify the root or it would default to nginx's default docroot.

Your regex works well, but only works for images without underscores, hyphens,
or anything infact that isn't just a continuous text string. Would it be easy
enough to modify in order to cope with this ?

More information about the nginx mailing list