Welcome! Log In Create A New Profile

Advanced

how I rewrite images locally on nginx server?

Posted by jpilon 
how I rewrite images locally on nginx server?
March 17, 2010 08:57PM
Hello,

Just started setting up nginx cluster (yippee!), but I'm having a tough time getting nginx to serve local images while forwarding php requests etc to one of the load balanced apache servers.

server {
gzip on;
listen 80;

rewrite ^/resource:shared_gif:(.*).gif$ /home/media/images/$1.gif break;

location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://balanced_servers;
}

}

It's sending everything to the balanced servers and that all works fine, but I want nginx to serve the images directly. Can anyone help? Also, any tips on optimzing the nginx in this config I'd appreciate :)
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 178
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready