Load balancing & local files

Fattie nginx-forum at nginx.us
Wed Sep 19 13:45:15 UTC 2012


I have 2 servers running Nginx on them while one of them also acts as a load
Each server accesses local unique image files that are generated in

I tried the following configuration for the load balancer nginx:

  upstream servername {
    server fail_timeout=10s;
    server x.x.x.x fail_timeout=10s;


    location /localimage {
      proxy_pass http://servername;
      root /path/to/localimage;
      expires 7d;
      access_log off;

Whenever the request is to server #2, I get the image, when it's to server
#1 (local) I don't.
If I remove the line "proxy_pass http://servername;" the problem goes other
way around.

What is the correct way to configure nginx to solve this?

Thanks in advance!

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

More information about the nginx mailing list