Image hotlinking rewrite

Jan Ślusarczyk jan.slusarczyk at dobrestrony.pl
Thu Jun 14 12:53:40 MSD 2007


Hi,
I'm using nginx to serve static files and proxy the dynamic requests  
to apache in the backend. It works very good and allowed me to free a  
lot of memory. Now | need to fight bandwidth staling on one of our  
servers and I can't solve the problem on my own.

This is the vhost config:

server {
     listen        x.x.x.x:80;
     server_name  www.servername.com www.otherservername.com;
     access_log  /var/log/nginx/www.servername.com.access.log  combined;
     #  vbulletin attachment rewrites
     location ~* ^.+.(attachments|customavatars|archive) {
         proxy_pass      http://apache;
         include         /etc/nginx/proxy.conf;
     }
    location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|rar|bz2|doc|xls| 
exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov)$ {
         root  /var/www/hosts/www.servername.com;
         expires 1d;
   }
     location / {
         proxy_pass      http://apache;
         include         /etc/nginx/proxy.conf;
     }
}

I need to redirect requests for images from specific hosts (I will  
compile the names every couple of days manually) to a specific file  
(ie. do_not_steal_bandwidth.gif).
Can you help me with this?

Jan Ślusarczyk
jan.slusarczyk at dobrestrony.pl



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20070614/897c255c/attachment.html>


More information about the nginx mailing list