Nginx cooperates with iis to build a load balancing process under windows

WBOY
Release: 2016-08-08 09:21:37
Original
924 people have browsed it

Because the project encounters a large number of image storage problems, although we don’t have a lot of images now ( is currently around 1T, and the expected growth rate is 1.3 times per year) , when I was thinking about how to effectively store a large number of pictures, I looked up some information and saw that someone used Nginx to build a server. For the purpose of learning, I also experienced it myself nginx The installation process under window, and cooperate with iis to build a load balancing process, the environment is as follows:



Explain it, because I I have only one computer, and in order to demonstrate the effect, I installed a virtual machine.

ComputerA:Install Nginx on this computer and also configure IIS, in order to discord Nginx of 80 Port conflict, be sure to modify it The port number, combined with the virtual machine B, is equivalent to 2servers for load balancing

virtual machineB:Simulate a server and establish IIS , the port number uses 80port.

Let’s talk about the resources that have been used during the installation process

Virtual machine resources:

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

VMUsage Guide Information :http: //open-source.blog.163.com/blog/static/1267734512010714103659611/

WindowsMirror resources: http://www.jb51. net/os/windows/Win2003/1904.html 中文nginx

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

Install

Nginx 1.

After downloading, unzip the file to the directory you specify. It may not necessarily be placed under C:

, I put it myself

is also possible, that is, during startup, you need to locate the CMD command to the D:programnginx directory

Note: I downloaded the version nginx-1.2.1 . After unzipping, change the file name nginx-1.2.1 to nginx

2.

Before formal installation, configure it first, open the conf/nginx.conf file in the directory


Then modify

Change the 80 to any port number, I changed it here to 8090.

3. Open the CMDcommand line tool and enter the nginxinstallation directory. Here is D:program nginx

Then enter :nginx

Enter, no Any tips, indicating that the installation is successful,Browser input 127.0.0.1:8090

Even if it is a small step of success.

The command to close Nginx is : nginx –s stop

4. The next step is to configure the server. Remember to change the changes you just made conf/nginx.conffileRestore it back to avoid confusion during later settingsAs mentioned before, I installed Nginx on

192.168.21.1 computer , then first configure the IIS above and create a test site www.nginxtest.com The port is 801 There is a

placed under this site

index.htmlpage

5.

Configuring IIS on the virtual machine, same On , the only difference is that the port number is set to 80 That’s it.

6 The final result is: Here is a detailed explanation:

A

area ,

The upstream here is added and must be added server {}Before this node is configured

This means have 2 machines are used for load balancing. www.nginxtest.com is a test site configured by myself B area,

is configured here

The port that nginx is listening on, here is the default configuration 80port, and the server IP where Nginx is located, My here is 192.168.21.1 C

area,

domain name to be represented After the configuration is completed, start nginx again, There will be 2NGINX

Browser input address: www.nginxtest.com Refresh a few more times The following

2

situations will occur, and the effect of 2

day service load balancing will be achieved

refresh a few more times, this will appear alternately. You're done!

Related articles:

Detailed introduction to running and starting Nginx configuration

The above introduces the process of setting up load balancing with Nginx in conjunction with iis under Windows, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template