一個ip能夠對應多個域名,好比現有:www.abc.com,須要增長test.abc.comhtml
先在域名解析中,添加A記錄,主機記錄爲test,記錄值和www的記錄值同樣nginx
服務器中80端口設置爲nginx,nginx.conf配置以下:服務器
server { listen 80; server_name www.abc.com; location / { root html; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } upstream myServer { server 59.110.40.41:8080; server 59.110.40.41:8090; } server { listen 80; server_name test.abc.com; location / { proxy_pass http://myServer; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }
myServer爲負載均衡配置負載均衡