upstream proxy1 {
        server 192.168.89.10:180;
}
upstream proxy2 {
        server 192.168.89.10:280;
    }
server {
    listen       80;
    server_name  www1.dlab.com;
    location / {
         proxy_pass http://proxy1;
    }
}
server {
    listen    80;
    server_name www2.dlab.com;
    location / {
        proxy_pass http://proxy2;
    }
}

server{}           配置虚拟主机必须有这个段
server_name        虚拟主机的域名,可以写多个,中间用空格隔开
listen 127.0.0.1:80     监听ip和端口,如果只有端口,表示所有ip
root /data/site/dir     站点根目录,尽量和域名一直,好记忆
access_log /data/site/dir.log    访问日志
location / {}       默认uri

版权声明:本文为djoker原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/djoker/p/6396385.html