Node.js nginx nodejs+;pm2返回无法获取/pm2
我安装了nginx来服务多个nodejs应用程序 在我的服务器上,我有两个应用程序myapp和pm2 web nginx配置如下所示Node.js nginx nodejs+;pm2返回无法获取/pm2,node.js,nginx,pm2,Node.js,Nginx,Pm2,我安装了nginx来服务多个nodejs应用程序 在我的服务器上,我有两个应用程序myapp和pm2 web nginx配置如下所示 http { # .... logs, gzip ... etc server { location / { proxy_pass http://localhost:5000; proxy_http_version 1.1; proxy_set_header Upgr
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网络未运行时,我得到502坏网关
但我仍然可以从
http://IP:9000
URL的/pm2
部分正在传递到您的节点应用程序,其中它不匹配任何路径
即,您的pm2应用程序正在9000
上运行,但您正在尝试访问http://localhost:9000/pm2
这是不存在的
在代理过程URL中包含尾部斜杠,以确保未包含/pm2
:
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;
}
最后使用
rewrite^/pm2(.*)$$1代码>我得到错误500
和重写^/pm2(.*)/$1中断
我得到pm2web版本{{version}
它返回pm2web版本{{version}
我想这是因为服务器找不到静态文件css|js
。。。等