Using software load balancer to implement Web server cluster (Iis+nginx) _ Server Other

Source: Internet
Author: User

I use Nginx to implement the Web site load Balancing test example, Windows IIS do load measurement.

If your site traffic (PV) more and more high, a server has no way to withstand the flow of pressure, then increase the number of Web servers to do load it.

Do site load can buy hardware equipment to achieve, our company is F5, but the price is hundreds of thousands of to millions, too expensive,

At present, many portals and large number of Web sites are using Nginx as an HTTP server, so nginx is very good, I personally do this load test.

Soft/Hardware Environment:

(2 servers)
First station:
Cpu:inter (R) Core i5 CPU 2.26GHz

Memory: 2G
System: Windows 7
Iis:iis 7
nginx:nginx/windows-0.8.22
ip:10.60.44.126
Environment: Local
Second Station:
Cpu:inter (R) Core i3 CPU 2.13GHz

Memory: 2G
System: Windows Server 2003
Iis:iis 6
ip:10.60.44.127
Environment: Remote

Attention:
This test, the software Nginx placed locally (10.60.44.126), that is, placed in the domain name binding of the server, this server IIS can not use 80 ports, because the next nginx software to use 80 of this port.
Download Nginx's address is as follows:
Nginx Download: http://nginx.net/
Download of the version used in this test: nginx/windows-0.8.22

Download extract to C:, change directory name to Nginx


Practice steps:

First:

In the local (10.60.44.126) server, IIS creates a Web site using a port of 808, as shown below:

IIS Web site bindings settings diagram

Second:

Create a Web site in remote 10.60.44.127 IIS using a port of 808, as shown below:


Remote IIS Binding settings diagram


Note: The first and second steps are bound to the same website program!

Third:

OK, the above has set up two server IIS, the following configuration Nginx software to implement the Web site load balancer, open the following file:

C:\nginx\conf\nginx.conf

1. Find Content Server {

Add the following to the above section:

Upstream chenlu.com {
Server 10.60.44.126:808;
Server 10.60.44.127:808;
}

(This is the server Web site IP used by the load switch)

2, find location/{
root HTML;
Index index.html index.htm;
}

Change the content as follows:

Location/{
Proxy_pass http://chenlu.com/;
Proxy_redirect default;
}

3. Locate server {
Listen 80;
server_name localhost;

Change the content to read as follows:

server {
Listen 80;
server_name 10.60.44.126;

(This is a request to monitor access to the server 80 port of the domain binding)

OK, here is the simple configuration, below look at the above 3 steps configuration diagram:

Load Balancer Configuration Diagram

Fourth:

All configured, the following start nginx this software

Enter the command prompt cmd, enter the C:\nginx>, enter the Nginx command, as shown below:


Start Nginx

At this point, the system process has two nginx.exe processes, as shown in the following figure:


System Nginx Process

Stop Nginx Run input nginx-s stop


Fifth:

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

On the local (10.60.44.126) This server opens IE, input: http://10.60.44.126/

The first time you open a Web site's results chart:



Run Web site map for the first time

Refresh the page and the resulting chart:



Visit the site map again

Very well, the website has been loaded successfully.

After this test, the implementation of the site load is no longer difficult. You don't have to buy very expensive hardware devices. Online introduction said Nginx software can deal with tens of thousands, so is definitely a very good choice.

If the site traffic is very large, you can specifically use a server to run Nginx, other server Run Web site program (a few server procedures are the same), so the load is not too big problem, if not again, the site to do a number of columns to do a 2-level domain name, 2 domain name also do the load, so more powerful it.

Nginx software runs better on Linux than it does on windows, so doing the load can be done with Linux run Nginx,.net Web sites that are developed on Windows Server IIS.


Attention:

1 Find the Local machine \windows\system32\drivers\etc, modify the Hosts file, add 10.60.44.126 www.chenlulouis123456.com comment out #host

2 Find the remote machine \windows\system32\drivers\etc, modify the Hosts file 10.60.44.127 www.chenlulouis123456.com

3.

Upstream chenlu.com
{
Server 10.60.44.126:808;
Server 10.60.44.127:808;
}
server {
Listen 80;
server_name http://www.chenlu123456.com/;

#charset Koi8-r;

#access_log Logs/host.access.log Main;

Location/{
Proxy_pass http://chenlu.com/;
Proxy_redirect default;
}

Through the above steps, you can make local and remote machines through domain name access to do experiments to avoid the actual domain binding.

Hope everybody likes ha!

Related Article

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.