Nodejs API doesn't work after reboot centos server

Viewed 264

In my centos server, I have an API with node js and I started with pm2. pm2 status is online and It works correctly. but when server reboot, can't connect to the API although pm2 status is online. I also try start node js like below

pm2 start index.js
pm2 startup 
pm2 save 

but It does not work until I restart pm2 .. how can I fix it?

1 Answers

You have to do pm2 resurrect to start an application after "pm2 saving" it:

pm2 resurrect

Then put this command in a script file and configure it to run on server reboot. Read this Q and A for help. Also in this article there are some CentOS specific changes that need to be done.

Related