Welcome! Log In Create A New Profile

Advanced

Load balancing & local files

September 19, 2012 09:45AM
Hi,

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

I tried the following configuration for the load balancer nginx:


upstream servername {
ip_hash;
server 127.0.0.1:9000 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;
break;
}


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!
Subject Author Posted

Load balancing & local files

Fattie September 19, 2012 09:45AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 63
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready