Bereitstellen einer Node.js-App mit PM2
Installieren Sie Node.js, führen Sie Ihre API mit PM2 aus und konfigurieren Sie den automatischen Neustart.
Bereit, Ihren Service zu starten? Überprüfen Sie Angebote und bestellen Sie online.
Angebote ansehen und bestellenZiel
Hosten Sie eine API oder einen Node.js Bot in Produktion mit automatischem Neustart dank PM2.
Installation Node.js und PM2
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt install -y nodejs
npm install -g pm2Deployment Application
- Cloner oder Uploader
Ihr Projekt in
/var/www/monapp, dannnpm ci --production. - Beginnen Sie mit PM2
pm2 start src/index.js --name monapp - Reverse Proxy Nginx
Proxy zu
http://127.0.0.1:3000(siehe Anleitung Nginx). - Reboot-Persistenz
pm2 startupdannpm2 save
Logarithmus
pm2 logs monapp und pm2 monit CPU/RAM zu überwachen.