Expires .. is there a way to set an expires header for all of jpg, gif, css, js ?
mike
mike503 at gmail.com
Sun Sep 7 01:22:54 MSD 2008
it's probably due to location parsing order. it can be confusing
this works like a charm:
server {
listen 80;
server_name michaelshadle.com;
index index.php index.html;
root /home/mike/web/michaelshadle.com;
location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|html)$ {
expires max;
}
error_page 404 = /wordpress/index.php?q=$request_uri;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:11000;
}
}
you don't actually -need- a location / either, it seems. unless your
config requires it due to some other stuff. but i don't have any of
those in mine and it works fine.
On Sat, Sep 6, 2008 at 10:10 AM, David <mishy.cth at gmail.com> wrote:
> You're absolutely right.
>
> When using:
>
> location ~* ^.+\.(jpg|jpeg|gif|png)$ {
> access_log off;
> expires 30d;
> }
>
> It ignores my:
>
> location / {
> index index.php index.html index.htm;
> root /home/user/public_html;
> }
>
> and tries to load the image from /usr/local/nginx/html
>
>
>
More information about the nginx
mailing list