Nginx as a Load Balancer

It is very basic setup of Nginx as a  load balancer. I have two Apache servers ( & Ngnix will act as a load balancer in front of these two servers

I have done it on Debian squeeze. So first we have to install nginx package

#apt-get install nginx

Edit the nginx configuration file. Before editing,  I have copied the original nginx conf file as default.orig

#cd  /etc/nginx/sites-available/

#/etc/nginx/sites-available# cp default default.orig

#vi  /etc/nginx/sites-available/default

upstream mysite {

server {

        #listen   [::]:80 default ipv6only=on; ## listen for ipv6
        access_log  /var/log/nginx/access.log;

        location / {
                proxy_pass http://mysite;
                proxy_set_header   Host $host;


#/etc/init.d/nginx restart

Its done.

Have FUN


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.