Welcome! Log In Create A New Profile

Advanced

Load balancing, missing a detail...

Floren Munteanu
March 23, 2009 12:37PM
Hi all,

I need your help with setting nginx as load balancer.
I have 2 servers, 192.168.1.2 (Web1) and 192.168.1.3 (Web2), both with
same content into /www/html directory.
Web1 has nginx installed.

http {
...
upstream webcluster {
server 192.168.1.2:8000;
server 192.168.1.3:8001;
}

ignore_invalid_headers on;
reset_timedout_connection on;
keepalive_timeout 60;

server {
listen 80;
server_name domain.com;
root /var/www/html;
access_log
/var/log/nginx/localhost.access.log main buffer=32k;
error_log
/var/log/nginx/localhost.error.log warn;

client_max_body_size 10m;
client_body_buffer_size 512k;

proxy_buffer_size 32k;
proxy_buffers 16 32k;
proxy_set_header Host $host;
proxy_set_header X-Real-IP
$remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;

error_page 404 = /404.html;
error_page 500 502 503 504 = /50x.html;

location / {
proxy_pass
$scheme://webcluster;
index index.php
index.html;
}
}
}

What am I missing? Do I need to install another software, like
TurboGears?
All I want is to load balance 2 servers who have the exact same
content...

I looked at this example:
http://wiki.nginx.org/NginxLoadBalanceExample

If I visit http://192.168.1.2:80/, I can see the site. Not if I go to
http://192.168.1.2:8000/...
With the above configuration, I get this error message:
2009/03/23 12:10:42 [error] 27847#0: *1 connect() failed (111:
Connection refused) while connecting to upstream, client: xx.xx.xx.xx,
server: domain.com, request: "GET /forum/ HTTP/1.1", upstream:
"http://192.168.1.3:8001", host: "domain.com"
2009/03/23 12:10:42 [error] 27847#0: *1 connect() failed (111:
Connection refused) while connecting to upstream, client: xx.xx.xx.xx,
server: domain.com, request: "GET /forum/ HTTP/1.1", upstream:
"http://192.168.1.2:8000", host: "domain.com"
2009/03/23 12:10:42 [error] 27847#0: *1 no live upstreams while
connecting to upstream, client: xx.xx.xx.xx, server: domain.com,
request: "GET /forum/ HTTP/1.1", upstream: "http://webcluster", host:
"domain.com"

Please let me know what else I need to configure, in order to enable the
balancer.

Regards,

Floren
Subject Author Posted

Load balancing, missing a detail...

Floren Munteanu March 23, 2009 12:37PM

Re: Load balancing, missing a detail...

Sergej Kandyla March 23, 2009 12:56PM

Re: Load balancing, missing a detail...

Floren Munteanu March 23, 2009 01:18PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 87
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