Expires .. is there a way to set an expires header for all of jpg, gif, css, js ?
Chris Savery
chrissavery at gmail.com
Sat Sep 6 20:22:34 MSD 2008
I think there's just a simple typo in your regex. Try,
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$
I've been using the expires 30d; and I think it works ok.
Chris :)
David wrote:
> 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
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20080906/85749520/attachment.html>
More information about the nginx
mailing list