1
我已經在我的nginx的配置文件設置的nginx的/ etc/nginx的/網站可用/有兩個上行流說有多個IP的
upstream test1 {
server 1.1.1.1:50;
server 1.1.1.2:50;
}
upstream test2 {
server 2.2.2.1:60;
server 2.2.2.2:60;
}
server {
location/{
proxy_pass http://test1;
}
location/{
proxy_pass http://test2;
}
}
發送捲曲請求<PrimaryIP>:80
的作品,但我想用<SecondaryIP1>:80
爲test1
和<SecondaryIP2>:80
對於test2
。有沒有可能在nginx中定義這個?
你想虛擬主機,這樣使用2對服務器各部分https://www.nginx.com/resources/wiki/start/topics/examples/server_blocks /。另請參閱https://serverfault.com/questions/241029/virtual-host-from-ip-address – ivo
在您的情況下,只能訪問一個塊。您需要使用虛擬主機作爲提到的@ivo –