我是靠谱客的博主 冷艳玉米,这篇文章主要介绍nginx域名配置,现在分享给大家,希望可以做个参考。

代理到同一二级域名的不同后台端口

server {              
    listen 80;
    server_name 二级域名;
    		location /dev-api {
            rewrite  ^.+dev-api/?(.*)$ /$1 break;
            include  uwsgi_params;
            proxy_pass http://localhost:8080/;
        }
            location /prod-api {
            rewrite  ^.+prod-api/?(.*)$ /$1 break;
            include  uwsgi_params;
            proxy_pass http://localhost:8081/;
        }
}

代理到不同二级域名

    server {              
    listen       80;    
    server_name  二级域名; 
    
    location / {
        root   /www/wwwroot/farm/dist;
        index  index.html index.htm;
    } 
    }
    
    server {              
    listen       80;    
    server_name  二级域名; 
    
    location / {
        root   /www/wwwroot/science/dist;
        index  index.html index.htm;
    } 
    }

最后

以上就是冷艳玉米最近收集整理的关于nginx域名配置的全部内容,更多相关nginx域名配置内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(116)

评论列表共有 0 条评论

立即
投稿
返回
顶部