﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
313	Issue with load balance several Apache instances.	Chamith Malinda		"Hi,

I tried to load balance two Apache instances (virtual hosts) In two different physical servers. 
Each one having more than one Apache virtual hosts with different domain names.

Let say there are two physical servers called ""A"" and ""B"",

Physical machine ""A"" have Apache virtual hosts with following domain names.    

1. exampleA1.com
2. exampleA2.com
etc . .  .

Physical machine ""B"" have Apache virtual hosts with following domain names. 

1. exampleB1.com
2. exampleB2.com
etc . .  .

Those Apache virtual hosts are working fine.

And I need to load balance exampleA1.com and exampleB1.com. So I used nginx for this with following configuration in my Local PC (for test before putting to a live server)

My target is load balance exampleA1.com and exampleB1.com from my local PC.


Following is my nginx.conf modifications,


http {

	upstream localhost {
	     server exampleA1.com:80;
	     server exampleB1.com:80;
	}

	server {
	    listen localhost:80;
	    server_name localhost;

	    location / {
	    proxy_pass  http://localhost;
	    }
	    }
}


So then when accessing http://localhost load balancing need to be happen.
And yes It's happening. But one problem.

It's picking other virtual host (Domain name) in the ""A"" physical machine. Instead of ""exampleA1.com"" it's picking ""exampleA2.com"" or any other one. In the ""B"" machine the same problem.

(When use browser to access those Apache URL 's - Working fine - directing to the correct destination)


Can't we balance the load two Apache instances in different PC s which are having more than one virtual hosts or Apache instances with different domain names ? 


----------------------------------------------

Apache configurations for exampleA1.com and exampleA2.com in ""A"" server like as follows,



<VirtualHost *:80>
	ServerAdmin xxxx@xxx.com
	DocumentRoot /var/www/
	ServerName exampleA1.com

	-----
</VirtualHost>

<VirtualHost *:80>
	ServerAdmin xxxx@xxx.com
	DocumentRoot /var/www/
	ServerName exampleA2.com

	------	
</VirtualHost>



Apache configurations for exampleB1.com and exampleB2.com in ""B"" server like as follows,


<VirtualHost *:80>
	ServerAdmin xxxx@xxx.com
	DocumentRoot /var/www/
	ServerName exampleB1.com

	-----
</VirtualHost>

<VirtualHost *:80>
	ServerAdmin xxxx@xxx.com
	DocumentRoot /var/www/
	ServerName exampleB2.com

	------
</VirtualHost>


Thanks,
Chamith.




"	defect	closed	major		nginx-core	1.1.x	invalid	load balancing	chamith.malinda@…	Linux chamith-HP-Pavilion-g6-Notebook-PC 3.2.0-24-generic-pae #39-Ubuntu SMP Mon May 21 18:54:21 UTC 2012 i686 i686 i386 GNU/Linux	"TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-auth-pam --add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-echo --add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-upstream-fair --add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-dav-ext-module"
