implementing NGINX loadbalancer
Posted
by
Alaa Alomari
on Server Fault
See other posts from Server Fault
or by Alaa Alomari
Published on 2012-12-16T09:21:57Z
Indexed on
2012/12/16
11:08 UTC
Read the original article
Hit count: 245
I have two servers (ServerA 192.168.1.10, ServerB 192,168.1.11) and DNS of test.mysite.com is pointing to ServerA
#in serverA i have this upstream lb_units { server 192.168.1.10 weight=2 max_fails=3 fail_timeout=30s; # Reverse proxy to BES1 server 192.168.1.11 weight=2 max_fails=3 fail_timeout=30s; # Reverse proxy to BES2 } server { listen 80; # Listen on the external interface server_name test.mysite.com; # The server name root /var/www/test; index index.php; location / { proxy_pass http://lb_units; # Load balance the URL location "/" to the upstream lb_units } location ~ \.php$ { include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/test/$fastcgi_script_name; } }
and ServerB is apache and it has the following
<VirtualHost *:80> RewriteEngine on <Directory "/var/www/test"> AllowOverride all </Directory> DocumentRoot "/var/www/test" ServerName test.mysite.com </VirtualHost>
but whenever i try to browse test.mysite.com, it serves me from ServerA. also i tried to mark serverA and down server 192.168.1.10 down;
in lb_units and still the same, serving me from serverA. any idea what i have done wrong??
© Server Fault or respective owner