Configuring Nginx clusters based on Windows

Source: Internet
Author: User
Tags nginx host

1. Download Nginx

Download page:

Http://nginx.org/en/download.html

Specific documents:

Http://nginx.org/download/nginx-1.7.0.zip

2. Operation Nginx

Unzip the first step to download the Nginx-1.7.0.zip compressed package to the C:/nginx path

2.1. Modify the Listening port

Since IIS is already configured on port 80, the Nginx listening port is now modified

server {

Listen 80;

Revision changed to

Listen 5000;

2.2. Modify Host

Modify System Host (path: C:\Windows\System32\drivers\etc\HOSTS):

To add a configuration:

127.0.0.1 wangkun.com

2.3. Start cmd Command Window

?
1 2 3 4 5 6 7 8 9 10 11 12 cd C:\nginx   //   Startup   Nginx start  nginx   /*     Common commands      Nginx-s stop         //Stop Nginx      nginx-s reload      /reload config file      nginx-s quit          //Exit Nginx   */

Browse http://wangkun.com:5000 in the browser to view the Nginx Welcome screen

2.4 Configuring Nginx Clusters

2.4.1 Configuring the IIS site:

web1:127.0.0.1:5069

web2:127.0.0.1:5070

2.4.2 Adjusting Nginx Configuration

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 events {     worker_connections  1024; } http {     include       mime.types;     default_type  application/octet-stream;       upstream  wangkun.com        {            server   127.0.0.1:5069;            server   127.0.0.1:5070;        }            server     {         listen       5000;         server_name  localhost;           location / {                   proxy_pass http://wangkun.com;             proxy_redirect default;                     }               error_page   500 502 503 504  /50x.html;         location = /50x.html {             root   html;         }           }}

 2.4.3 Verification:

Browse by Browser: http://wangkun:5000

Now that you have stopped IIS web01, the page you browsed is always displayed WEB02

Note:

In a production environment, Nginx can be deployed on Linux with a separate Linux nginx host conversion request mapped to Windows IIS

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.