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,服务器,运维)