不能在nginx中使用apidoc和反向代理

时间:2017-07-12 11:59:14

标签: node.js nginx

我有一个测试服务器并尝试使用反向代理在node.js上提供apidoc但在浏览器中我看到一个空页。

apidoc在node.js的端口3034上与http-server一起使用,我用pm2运行它,这是我在站点可用的默认配置

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;
    index index.html index.htm index.nginx-debian.html;

    server_name _;

    location /docs {
            proxy_pass http://localhost:3034;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_cache_bypass $http_upgrade;
    }

    location / {
            proxy_pass http://localhost:3000;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_cache_bypass $http_upgrade;
    }

}

0 个答案:

没有答案