All Guides
Node.js App Management with PM2
Manage your Node.js applications in production with PM2 process manager.
Intermediate15 min
Setup Steps
1. Install PM2 globally:
npm install -g pm22. Start your application:
pm2 start app.js --name "myapp"3. Start a Next.js application:
pm2 start npm --name "nextjs" -- start4. Basic commands:
pm2 list # List applications
pm2 stop myapp # Stop
pm2 restart myapp # Restart
pm2 delete myapp # Delete
pm2 logs myapp # Show logs
pm2 monit # Live monitor5. Auto-startup configuration:
pm2 startup
pm2 save6. Ecosystem file (ecosystem.config.js):
module.exports = {
apps: [{
name: 'myapp',
script: 'app.js',
instances: 'max',
exec_mode: 'cluster',
env: {
NODE_ENV: 'production',
PORT: 3000
}
}]
}7. Start with ecosystem:
pm2 start ecosystem.config.js8. Zero-downtime update:
pm2 reload myappRelated Guides
Git and GitHub Setup
Install Git version control system and manage projects with GitHub.
VS Code Setup and Extensions
Install Visual Studio Code editor and enhance it with developer extensions.
GitHub Actions CI/CD Setup
Create an automated test, build and deploy pipeline with GitHub Actions.
Cloudflare DNS and CDN Setup
Add Cloudflare to your site. DNS management, CDN, DDoS protection and SSL.