All Guides
Node.js App-Verwaltung mit PM2
Verwalten Sie Ihre Node.js-Apps in der Produktion mit PM2.
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 und GitHub Einrichtung
Installieren Sie Git und verwalten Sie Projekte mit GitHub.
VS Code Einrichtung und Erweiterungen
Installieren Sie VS Code und erweitern Sie es mit Entwickler-Erweiterungen.
GitHub Actions CI/CD Einrichtung
Erstellen Sie eine automatisierte Test-, Build- und Deploy-Pipeline.
Cloudflare DNS und CDN Einrichtung
Fuegen Sie Cloudflare zu Ihrer Website hinzu. DNS, CDN, DDoS-Schutz.