Welcome! Log In Create A New Profile

Advanced

How to use nginx as loadbalancer for different webserver?

Jörg Kastning
April 21, 2013 02:32AM
Hello all.

I'm new to this maillinglist as to nginx as well. I setup a nginx to run as
a loadbalancer with just adding the following lines to my
/etc/nginx/nginx_conf. This config works fine.

http {
upstream loadbalancer1 {
server 192.168.0.1:80;
server 192.168.0.2:80;
}

server {
listen 80;
server_name www.example.com example.com;
location / {
proxy_pass http://loadbalancer1;
}
}

Please note, that example.com isn't my real domain. So that's not the error. ;-)

Now I tried to add a second site which is hosted on two different
webservers. My configuration in /etc/nginx/nginx_conf looks like the
following now.

http {
upstream loadbalancer1 {
server 192.168.0.1:80;
server 192.168.0.2:80;
}

server {
listen 80;
server_name www.example.com example.com;
location / {
proxy_pass http://loadbalancer1;
}
}

upstream loadbalancer2 {
server 192.168.0.3:80;
server 192.168.0.4:80;
}

server {
listen 80;
server_name www.anyway.com anyway.com;
location / {
proxy_pass http://loadbalancer2;
}
}}

But if I try to get www.anyway.com it didn't work and I got a request
timeout. Could somebody please tell me, what's wrong with my
configuration?


Best Regards

Joerg
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

How to use nginx as loadbalancer for different webserver?

Jörg Kastning April 21, 2013 02:32AM

Re: How to use nginx as loadbalancer for different webserver?

GreenGecko April 21, 2013 02:40AM

Re: How to use nginx as loadbalancer for different webserver?

mex April 21, 2013 04:21AM

Re: How to use nginx as loadbalancer for different webserver?

Jörg Kastning April 22, 2013 02:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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