gaowei1012 / blog

this is blog
2 stars 0 forks source link

mac 配置 nginx #32

Open gaowei1012 opened 4 years ago

gaowei1012 commented 4 years ago

mac 配置 nginx

gaowei1012 commented 4 years ago

http {
    # 第一个服务器 监听 8080
    server {

        listen 8080;
        server_name localhost;

        location / {
            root html;
            index index.html index.htm;
        }

        # 匹配接口地址是以 /api开头,继续向下匹配
        location ~ /api { 
            proxy_pass http://localhost:3000;
        } 
    }

    # 第二个服务器 监听 9080
    server {
        listen 9080;
        server_name localhost;

        #localhost / {
        #    root html;
        #    index index.html index.htm;
        #}

        # 匹配接口在 接口
        location / {
            proxy_pass http://localhost:7001;
        }
    }
}

# 项目地址
    server {
        listen 7070;
        server_name www.test.com;

        location / {
            root html;
            index index.html index.htm;
        }
    }

    # 接口地址
    server {
        listen 7967;
        server_name www.163yx.com;

        location / {
            proxy_pass http:location:8080;
        }
    }