Guys recently I implemented Nginx as a load balancer.
The scenario was that we have two Apache backend servers serving
same webpage. We were using Amazon ELB as a front-end to balance load for those
backend Apache servers. And we were paying to Amazon for their instance.
So I implemented (Replaced Nginx in place of ELB) Nginx as a
load balancer.
Below is the sample configuration file of my nginx.conf
===============================================
upstream front_cluster {
ip_hash;
server
10.64.0.11:80 weight=1 max_fails=2
fail_timeout=20;
server
10.64.0.10:80 weight=1 max_fails=2
fail_timeout=20;
}
server {
listen 80 ; ssl off;
listen
443 ssl;
server_name
abc.com;
access_log logs/abc.com.access.log;
error_log logs/abc.com.error.log info;
ssl_certificate /usr/local/nginx/abc.crt;
ssl_certificate_key /usr/local/nginx/abc.key;
location / {
proxy_pass http://front_cluster/;
proxy_set_header Host $server_name;
}
location
/lb_health_status {
check_status;
access_log off;
}
}
}
========================================
In this configuration we were using nginx for balancing
https and https both traffic to backend servers.
Also we are checking the health status of backend servers by
nginx health check module.
No comments:
Post a Comment