window run down Nginx , easy to implement load Balancing experiment environment: (2 servers)
First set:
System: Win2003
nginx:nginx/windows-0.8.32
ip:192.168.0.51
Environment: Local
Second set:
System: Win2003
ip:192.168.0.52
Environment: Remote
Description
This test, the software Nginx placed on the local (192.168.0.51), that is placed in the domain name binding server, this server IIS can not use 80 port, because the Nginx software to use 80 this port. (For convenience, I added the local hosts file I want to test the domain name 192.168.0.51 www.g.cn)
Download Nginx's address as follows:
Nginx Download: http://nginx.net/
Download unzip to C # and change the directory name to Nginx
All ready, start experimenting:
The most:
On the local (192.168.0.51) server, IIS creates a Web site that uses a port of 808, such as:
No.2:
In remote 192.168.0.52 IIS, create a Web site that uses a port of 80, such as:
No.3:
Well, the above has been set up two server IIS, the following configuration Nginx software to achieve web site load Balancing, open the following file:
C:\nginx\conf\nginx.conf
1. Find Content Server {
Add the following on top of it:
Upstream www.g.cn {
Server 192.168.0.51:808;
Server 192.168.0.52:80;
}
(This is the server site IP that the load switch uses)
2. Locate Location/{
root HTML;
Index index.html index.htm;
}
Change the content as follows:
Location/{
proxy_passhttp://www.g.cn;
Proxy_redirect default;
}
3. Locate the server {
Listen 80;
server_name localhost;
Change the content to read as follows:
server {
Listen 80;
server_name 192.168.0.51;
(This is a request to listen for access to the domain name binding that server 80 port)
OK, here is the simple configuration, see below the above 3-step configuration diagram:
Load configuration diagram
No.4:
All configured, the following to start the Nginx software
Go to command prompt cmd, enter c:\nginx>, enter Nginx command, such as:
Start Nginx
At this time, the system process has two nginx.exe processes, such as:
System Nginx Process
(Stop nginx operation input nginx-s stop)
No.5:
After the above configuration, we now look at the load effect:
On the local (192.168.0.51) This server opens IE, enter: http://192.168.0.51
The result of opening the site for the first time:
Refresh the page, the results appear:
OK, Test successful O (∩_∩) o
After this test, it is not difficult to see the load balance of the website. There is no need to purchase additional hardware devices. To add, Nginx software runs better on Linux than it does on Windows, so the load can be placed on Windows Server IIS with a Web site developed by Linux running Nginx,.net.
If the site access is very large, you can use a server to run Nginx, other servers run the website program (a few server programs are the same), so that the load is not too much trouble, if not, the site some columns to do a 2-level domain name, 2-level domain name also do load, so OK.
Original address: http://www.server110.com/nginx/201309/959.html
Window settings nginx+iis for load Balancing