简体   繁体   English

无法使用 pm2 启动 express 应用程序

[英]cound't start express app using pm2

I do nodemon it's fine but too bad nodemon isn't restart the app when something happened.我做 nodemon 很好,但太糟糕了 nodemon 在发生某些事情时没有重新启动应用程序。

Where's what i've tried in my ubuntu server :我在 ubuntu 服务器中尝试过的内容是什么:

  1. npm install pm2 -g
  2. go to my app directory and do pm2 start app.js转到我的应用程序目录并执行pm2 start app.js
  3. pm2 startup ubuntu

My app still has 502 bad gateway error.我的应用程序仍然有 502 bad gateway 错误。 Sigh why does this happens?咳咳,为什么会这样? I do nodemon it's running.. Strange thing is in the terminal pm2 did show an app and it's online :(我做nodemon它正在运行..奇怪的是在终端 pm2 确实显示了一个应用程序并且它在线:(

1) Check if your application is listed in PM2, use the command pm2 list 1) 检查你的应用程序是否在 PM2 中,使用命令pm2 list

2) Running apps should be listed, you can either find an online or errored status for each app 2)应列出正在运行的应用程序,您可以找到每个应用程序的onlineerrored状态

在此处输入图片说明

3) If your app is online , try to curl localhost:port ( if this works, something is wrong with your firewall or nginx / apache configuration) 3)如果您的应用程序online ,请尝试curl localhost:port (如果可行,则说明您的防火墙或 nginx / apache 配置有问题)

4) If it is errored , please check pm2 log - ~/.pm2/pm2.log ' 4)如果errored ,请检查日志PM2 - 〜/ .pm2 / pm2.log“

如果 pm2.log 显示“...有太多不稳定重启...”,请尝试解决方案https://stackoverflow.com/a/30651668/3054511

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM