回覆列表
-
1 # dfudn112
-
2 # 環球世紀冰河
upstreamhello.test.com{
server192.168.1.221;
}
server{
listen10;
#server_namehello.test.com;
access_loglogs/hello.test.com.access.logmain;
location/{
proxy_passhttp://192.168.1.221:10000;
proxy_set_headerHost$host;
#proxy_set_headerX-Real-IP$remote_addr;
#proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;
}
}
server{
listen11;
#server_namehello.test.com;
access_loglogs/hello.test.com.access.logmain;
location/{
proxy_passhttp://192.168.1.222:10001;
proxy_set_headerHost$host;
#proxy_set_headerX-Real-IP$remote_addr;
#proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;
}
}
nginx中,每個server塊代表一個或多個站點server塊中的server_name用於區分站點如果站點內容完全相同,只是域名不同,則可以在server_name後追加域名如果站點之間沒有關聯,則追加一個server塊 ,然後配置server_name以及其他站點資訊