gaowei1012/blog

mac 配置 nginx

Opened this issue · 1 comments

mac 配置 nginx


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;
        }
    }