pm2 process manager for node.js
Auto Start pm2 on boot
How to host static site using pm2
pm2 is a process manager for node.js applications. It is similar to forever.
First you need to install npm, on Ubuntu/Debian, run
1 |
apt install npm |
To install pm2, run
1 |
npm install pm2 -g |
Start an Application
1 |
pm2 start app.js |
Start an Application with name
1 |
pm2 start app.js -n "app-name-here" |
Start Application in Cluster mode with
1 |
pm2 start app.js -n "app-name-here" -i 5 |
To Scale a clustered application, run
1 |
pm2 scale app-name-here 2 |
Start the processes on reboot
1 2 |
pm2 save pm2 startup |
List running applications
1 |
pm2 ls |
Controlling running application
1 2 3 |
pm2 stop pm2 restart pm2 delete |
Restart all running applications
1 |
pm2 restart all |