July 12, 2022 . 1 MIN READ
On a droplet, you can run npm run start to launch your application. However, this requires you to keep the terminal session open for the app to continue running.
This is where PM2 comes in. PM2 allows you to run your application in the background and ensures it automatically restarts if the server (droplet) reboots. You can manage your apps easily with commands like:
pm2 restart – Restart all configured applications
pm2 status – Check running apps and their current status
OpenLiteSpeed (OLS), similar to Apache or Nginx, is a web server that controls how your application is exposed to the public. Performing a graceful restart in OLS only applies configuration changes to the web server—it does not restart or affect your Node.js application.
Reference:
https://serverfault.com/questions/1083530/litespeed-nextjs-app-in-digitalocean-droplet-restart-custom-server