一个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为负载均衡配置负载均衡