How to build a server load balancer using Nginx in combination with iis in windows

Source: Internet
Author: User
: This article mainly introduces how to set up server load balancer with iis in windows. if you are interested in PHP tutorials, refer to it.

Because the project has encountered a large number of image storage problems, although we still have a lot of images (currently up or down 1 TB, it is estimated that the growth rate is 1.3 times per year ), when I think about how to effectively store a large number of images, I find some materials and see that some people use Nginx to build servers for the purpose of learning, I personally experienced the installation process of nginx in the window and used iis to build a server load balancer. The environment is as follows:

How to build server load balancer with iis in windows ">



To demonstrate the effect, I installed a virtual machine on my own computer.

Computer A: Nginx is installed on this computer and IIS is also configured. in order not to conflict with Port 80 of Nginx, it is necessary to modify the port number to work with virtual machine B, which is equivalent to two servers for load balancing.

Virtual Machine B: simulate a server, create IIS, and use port 80 on the port number.

The following describes the resources used in the installation process.

Virtual machine resources:

Thunder: http://6.jsdx3.crsky.com/software1/VMwareworkstation-v9.0.1.zip

VM user guide material: http://open-source.blog.163.com/blog/static/1267734512010714103659611/

Windows Image resources: http://www.jb51.net/ OS /windows/Win2003/1904.html

Nginx resources:

Chinese nginx: http://www.ostools.net/apidocs/apidoc? Api = nginx-zh

Install Nginx

1. After the download, decompress the file to your specified directory, not necessarily under C: \, and I put it myself.

How to build server load balancer with iis in windows ">

The command CMD is required to locateD: \ program \ nginx directory.

Note: I downloadedNginx-1.2.1This version, decompress, change the file name nginx-1.2.1 to nginx

2. Before the installation, configure and openConf/nginx. conf file

How to build server load balancer with iis in windows ">


Then modify

SetChange 80 to any port number. here I will change it to 8090.

3. Open the CMD command line tool and go to the nginx installation directory. here isD: \ program \ nginx

Enter nginx

Press Enter. If no prompt is displayed, the installation is successful. enter127.0.0.1: 8090

It takes only one small step to succeed.

The command to disable Nginx is:Nginx-s stop

4. The next step is to configure the server. remember to restore the modified conf/nginx. conf file to avoid confusion during subsequent settings.

As mentioned above, I installed Nginx on the 192.168.21.1 computer, so configure the IIS above to create a test site.The port www.nginxtest.com is 801.

An index.html page is placed under this site.

5. Configure IIS on the virtual machine. The only difference is that the port number can be set to 80.

6. Modify the nginx configuration fileConf/nginx. confThe modified result is:

Here is a detailed description:

A Region. the upstream here is added and must be added before the server {} node configuration.

This indicates that two machines are used for load balancing. Www.nginxtest.com is a test site configured by myself.

In Area B, the nginx listening port is configured here. port 80 is configured by default and the IP address of the Nginx server is used here.

Region C,Domain name to be proxy

After the configuration is complete, start nginx again. here there are two NGINX

Enter the address in the browser: www.nginxtest.com

If you refresh multiple times, the following two cases will occur, and the two-day service load balancing effect will be achieved.

Refresh several times, which will appear alternately. Success!

Related articles:

Detailed introduction of running and starting Nginx configuration

The preceding section describes how to use Nginx in combination with iis to build a server load balancer in windows, including some content. if you are interested in PHP tutorials, please help.

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.