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 19:54:03 MSD 2008


Hi,

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

I have been reading through the docs and have tried a few things such as:

        location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html)$ {
            access_log        off;
            expires           30d;
        }

This made me think what I am asking must be possible, but the above makes every
page on my site 404.

            location ~* ^.+\.(jpg|jpeg|gif)$ {
                root         /spool/www;
                access_log   off;
                expires      30d;
            }

This would work, but I don't have a fixed root for images. I'd like to do it
throughout an entire site - or would I simply change the root in the above
example to my document root ?

Thanks






More information about the nginx mailing list