windows平台下利用Nginx做負載平衡

來源:互聯網
上載者:User

標籤:default   direct   權重   main   list   目錄   叢集   下載   .exe   

1.下載nginx(http://nginx.org/en/download.html)安裝包,解壓,並使用cmd命令轉到nginx.exe所在的目錄

2.執行cmd命令start nginx啟動nginx服務

3.在iis上部署3個網站(數量任意),ip地址分別為:

192.168.199.104:8081
192.168.199.104:8082
192.168.199.104:8083

4.配置nginx.conf

    #伺服器的叢集    upstream  netitcast.com {  #伺服器叢集名字          #server   172.16.21.13:8081 weight=1;#伺服器配置   weight是權重的意思,權重越大,分配的機率越大。        #server   192.168.1.186:8081 weight=1;        server   172.16.1.14:8081 weight=2;        server   172.16.1.15:8081 weight=1;        #server   172.16.1.15:80 weight=1;            }        #當前的Nginx的配置    server {        listen       80;#監聽80連接埠,可以改成其他連接埠        server_name  localhost;##############    當前服務的網域名稱        #charset koi8-r;        #access_log  logs/host.access.log  main;        #location / {        #    root   html;        #    index  index.html index.htm;        #}    location / {            proxy_pass http://netitcast.com;            proxy_redirect default;        }

5.使用cmd命令重新載入配置:nginx -s reload

6.運行192.168.199.104可以通過實現預設的不同的首頁來查看每次訪問的真實網站

7.使用cmd命令關閉nginx服務:nginx -s stop

windows平台下利用Nginx做負載平衡

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.