在我的server1上,我以reverse_proxy的身份运行nginx到server2,它在端口3000上运行node.js应用程序(完全平均堆栈)
当我用咕噜开始server2时,一切都很好
-- server2 ---
cd /opt/mean
grunt # running server.js , MEAN app作为下一个学习步骤,我正在尝试使用pm2在server2上监视我的测试web应用程序。我安装了pm2并运行
-- server2 ---
cd /opt/mean
pm2 start server.js并得到了
[PM2] restartProcessId process id 0
[PM2] Process successfully started
┌──────────┬────┬──────┬──────┬────────┬─────────┬────────┬─────────────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ memory │ watching │
├──────────┼────┼──────┼──────┼────────┼─────────┼────────┼─────────────┼──────────┤
│ server │ 0 │ fork │ 2182 │ online │ 14 │ 0s │ 10.867 MB │ disabled │
└──────────┴────┴──────┴──────┴────────┴─────────┴────────┴─────────────┴──────────┘
Use `pm2 show <id|name>` to get more details about an app
yves@gandalf:/opt/mean$ pm2 show server
Describing process with id 0 - name server
┌───────────────────┬─────────────────────────────────────────┐
│ status │ errored │
│ name │ server │
│ id │ 0 │
│ path │ /opt/mean/server.js │
│ args │ │
│ exec cwd │ / │
│ error log path │ /home/yves/.pm2/logs/server-error-0.log │
│ out log path │ /home/yves/.pm2/logs/server-out-0.log │
│ pid path │ /home/yves/.pm2/pids/server-0.pid │
│ mode │ fork_mode │
│ node v8 arguments │ │
│ watch & reload │ ✘ │
│ interpreter │ node │
│ restarts │ 28 │
│ unstable restarts │ 0 │
│ uptime │ 0 │
│ created at │ N/A │
└───────────────────┴─────────────────────────────────────────┘
Process configuration
Revision control metadata
┌──────────────────┬─────────────────────────────────────────────┐
│ revision control │ git │
│ remote url │ https://github.com/meanjs/mean.git │
│ repository root │ /opt/mean │
│ last update │ 2015-09-04T15:02:21.894Z │
│ revision │ 3890aaedf407151fd6b50d72ad55d5d7566a539b │
│ comment │ Merge pull request #876 from codydaig/0.4.1 │
│ branch │ master │
└──────────────────┴─────────────────────────────────────────────┘当我试图在浏览器中请求我的应用程序时,我现在从server1中得到一个错误
502 Bad Gateway nginx/1.4.6 (Ubuntu)
是否必须在nginx默认配置中添加或更新任何内容,因为proxy_pass指令指向http://:3000。
非常感谢您的反馈和2016年新年快乐!
发布于 2016-01-06 17:20:02
那个"pm2显示“显示您的节点服务器出错了,所以它可能没有运行。如果您跟踪错误日志,您会看到什么?里面应该有关于这个问题的一些细节。
我认为代理错误可能是因为节点没有运行
https://stackoverflow.com/questions/34638843
复制相似问题