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

Delta Yeh delta.yeh at gmail.com
Sat Sep 6 20:07:13 MSD 2008


Igor has the plan to add expire by response content-type.
Let's wait it. :)

2008/9/6 David <mishy.cth at gmail.com>:
> 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