Exempting a file from the expires header

renders nginx-forum at nginx.us
Wed Nov 24 17:15:44 MSK 2010


HI all.. I have implemented nginx as a front end proxy for my ISPconfig
3 apache based web server. Works quite nice but I have one issue. I have
some png files that are recreated every few minutes. 

I am using the expires option on static files so I want to exempt these
png files but not all png files.

If I understand correctly, this is done with another location directive,
something like below

location /weather/graphics/*.png {
    expires off
    root /var/www/VIRTUAL1.com/web/;
   access_log  /var/log/ispconfig/httpd/VIRTUAL1.com/access.log;

Question is where do I put this?

Thanks for your help..

Rob


My vhost conf file is below. host name has been changed.. 

server {
#   listen 80;
   server_name www.VIRTUAL1.com VIRTUAL1.com;
    #default proxy settings shared are among all virtual hosts
    access_log off;
    include /etc/nginx/proxy.conf;
      location ~*
^.+.(jpe?g|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|html?|txt|tar|mid|midi|wav|bmp|rtf|js|swf|avi|mp3)$
{
           #forcing browser to cache locally static content for 1 day
           expires 1d;
           root /var/www/VIRTUAL1.com/web/;
           access_log 
/var/log/ispconfig/httpd/VIRTUAL1.com/access.log;
           #graceful fallback in case if static content doesn't exist
<------>   include /etc/nginx/proxy_fallback.conf;
      }
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,152951,152951#msg-152951




More information about the nginx mailing list