Image hotlinking rewrite

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

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;
     access_log  /var/log/nginx/  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/;
         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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list