A recent study of Nginx,nginx as a reverse proxy server provides acceleration to the Web server and features load balancing.
First of all, I want to download Nginx (http://nginx.org/en/download.html) on the official website, the latest stable version is 1.0, Linux and Windows version I have been down, on the two servers to do the site load balancing.
In the version of Windows, unzip the package and execute the command:
Start Nginx
This will enable the Nginx service to start. and execute the command:
Nginx-s stop
You can stop the service.
This is my IIS server on 192.168.3.82, add two sites:
These two sites add two files index.html, two file contents respectively: "This is Site 1", "This is Site 2".
In the nginx.conf configuration file, adjust the relevant configuration:
Upstream site {server 192.168.3.82:8040;server 192.168.3.82:8041;} server {Listen 8080;server_name 192.168.3.82; # CharSet Koi8-r; #access_log Logs/host.access.log Main; Location/{root Html;index index.html index.htm;proxy_pass http://site;}
You can then save the file.
Then run the start Nginx, when you constantly refresh the page, the browser will switch back and forth the two sites.
Can be found here switching is 1:1 way back and forth, through the configuration file you can site weight:
Upstream site {server 192.168.3.82:8040 weight=2; Server 192.168.3.82:8041 weight=1;}
Weight is the weight of the corresponding website.
In Linux, installing Nginx is a bit cumbersome because you need to install some packages, such as Gzip,pcre and so on. Can be viewed in detail: http://www.cnblogs.com/yuanermen/archive/2011/03/31/2000993.html
You can deploy your site on Linux, such as Site 3, if you want to use a Windows server as a reverse proxy server, add a new site at upstream site:
Upstream site {server 192.168.3.82:8040 weight=2; Server 192.168.3.82:8041 weight=1; Server 192.168.3.90:8080;}
You can also use Nginx to cache static files (such as JPG,GIF,CSS,JS, etc.) on the reverse proxy server, so that when you need to request static resources from the Web server, you can get a local resource directly from the reverse proxy server. This reduces the stress on the Web server. Can be viewed in detail:http://www.cnblogs.com/daizhj/archive/2009/11/03/1595292.html
Using Nginx to do load balancing