Tips on running PM2

From what I learn when using these NPM run prod / dev to start server and hook them up using nginx. From the PM2 website, PM2 is a daemon process manager that will help you manage and keep your application online 24/7.

npm config set unsafe-perm true

# installing pm2 on linux
sudo npm i -g pm2 
sudo npm install [email protected] -g

# install pm2
npm install pm2 -g

# pm2 to start npm run dev
pm2 start "npm run dev" --name myAppName

# pm2 start npm start
pm2 start npm --name "app name" -- start

# pm2 node start
# only start will make it
pm2 start app.js

# start stop restart pm2shell

pm2 start app.js --name "my-api"
pm2 start web.js --name "web-interface"
pm2 stop web-interface
pm2 restart web-interface

Subscribe to You Live What You Learn

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]