运用nginx和阿里云解析配置二级域名 设置不同端口号

server {
        listen 80 default_server; #监听端口
        root /mnt/aa; #访问根目录
        index index.html index.htm; #默认页,可以不设置
        server_name www.yanyusun.com; #根据域名跳转
        location / {
                try_files $uri $uri/ =404;
                proxy_pass http://127.0.0.1:8081;  #跳转的路径
        }
}
server {
        listen 80;#监听端口
        root /mnt/bb;
        index index.html index.htm;
        server_name bs.yanyusun.com;
        location / {
                try_files $uri $uri/ =404;
                proxy_pass http://127.0.0.1:8082; #另一个路径
        }
}

猜你喜欢

转载自blog.csdn.net/qq_38571996/article/details/83089877