[英]Start Node JS application when server reboots with pm2
I am trying to use the module pm2
to start my node js app everytime the server boots. 我试图使用模块
pm2
每次服务器启动时启动我的节点js应用程序。 I have used the command pm2 startup ubuntu
but each time I restart the server, my application is not running and I have to start it manually again. 我使用命令
pm2 startup ubuntu
但每次重启服务器时,我的应用程序都没有运行,我必须再次手动启动它。
Any ideas what is causing this issue? 是什么导致了这个问题?
Make sure you do save your processes: 确保您确实保存了您的流程:
pm2 start app.js
pm2 startup ubuntu
pm2 save
Once you have started the apps and want to keep them on server reboot do:
pm2 save
一旦你启动了应用程序并希望将它们保留在服务器重启上,请执行:
pm2 save
Source: https://github.com/Unitech/PM2/blob/master/ADVANCED_README.md#startup-script 资料来源: https : //github.com/Unitech/PM2/blob/master/ADVANCED_README.md#startup-script
Go to your server directory and use the following commands: 转到您的服务器目录并使用以下命令:
pm2 start <your_app_name.js>
pm2 startup ubuntu
pm2 save
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.