Tools# pm2# nextjs# nodejs# deployment
Keep Next.js Running in Background with PM2
Last updated: 4/20/2026
Background Execution
To ensure your site stays up after closing the terminal:
- Install PM2:
npm install -g pm2 - Start app:
pm2 start npm --name "my-app" -- run start - Save list:
pm2 save - Startup script:
pm2 startup
PM2 will automatically restart your app if it crashes or the server reboots.