標籤: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做負載平衡