Load balancing for Nginx and IIS

Source: Internet
Author: User
If you have been concerned about nginx, you must know what is the use of Nginx software, if your website access is increasing, a server has no way to withstand traffic pressure, then increase the number of servers to do the load bar. Do Web site load can buy hardware equipment to achieve, such as F5, but the price of hundreds of thousands of to millions, enough expensive, this article describes the Web site load software is free, nginx at present a lot of portals and large number of Web sites are used as an HTTP server, so Nginx is very excellent, Let's do the load test below.
Environment:
(2 servers)
First set:
Cpu:inter (R) Pentium (r) 4 CPU 2.8G
Memory: 1G
System: Windows 7
Iis:iis 7
nginx:nginx/windows-0.8.22
ip:172.10.1.97
Environment: Local
Second set:
Cpu:inter (R) Pentium (r) 4 CPU 3.0G
Memory: 2G
System: Windows Server 2003
Iis:iis 6
ip:172.10.1.236
Environment: Remote

Description
This test, the software Nginx placed on the local (172.10.1.97), 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.
Download Nginx's address as follows:
Nginx Download: http://nginx.net/
Version downloaded for this test: nginx/windows-0.8.22

Download Unzip to C:, change the directory name to Nginx

Well, below into practice:

First:

On the local (172.10.1.97) server, IIS creates a Web site that uses a port of 808, such as:

Second:

In remote 172.10.1.236 IIS, create a Web site that uses a port of 80, such as:

Third:

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 to this:

Upstream xueit.com {
Server 172.10.1.97:808;
Server 172.10.1.236: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_pass http://xueit.com/;
Proxy_redirect default;
}

3. Locate the server {
Listen 80;
server_name localhost;

Change the content to read as follows:

server {
Listen 80;
server_name 172.10.1.97;

(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:

Fourth:

All configured, the following to start the Nginx software

Go to command prompt cmd, enter c:\nginx>, enter Nginx command, such as:

at this time, the system process has two nginx.exe processes, such as:

Stop Nginx Run input nginx-s stop

Fifth:

After the above configuration, we now look at the load effect:

On the local (172.10.1.97) This server opens IE, enter: http://172.10.1.97/

The first time you open a result diagram for a Web site:

to refresh the page, the resulting graph appears:

Well, the site has been loaded successfully.

After this test, it is no longer difficult to achieve a website load. There is no need to purchase very expensive hardware devices. Online introduction said Nginx software can deal with tens of thousands, so absolutely is a very good choice.

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 the load, so much more powerful bar.

Nginx software runs better on Linux than it does on Windows, so load can be placed on Windows Server IIS with a Web site developed by Linux running Nginx,.net.


The above describes the Nginx and IIS balanced load, including the contents of the content, I hope the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.