【发布时间】:2016-08-02 23:45:21
【问题描述】:
我安装了 nginx 来为多个 nodejs 应用程序提供服务
在我的服务器上,我有 2 个应用程序 myapp 和 pm2-web
nginx 配置如下所示
http {
# .... logs, gzip ... etc
server {
location / {
proxy_pass http://localhost:5000;
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 /pm2 {
proxy_pass http://localhost:9000;
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;
}
}
我的应用运行良好,但当我尝试访问 /pm2
我收到以下错误
Cannot GET /pm2
当 pm2-web 没有运行时,我得到 502 Bad Gateway
但我仍然可以从http://IP:9000 访问 pm2
【问题讨论】: