If you're running a Node.js service and want to keep it running in the background even after you log out, PM2 is a great tool to use. In this tutorial, we'll walk through the steps of starting and running a Node.js service in the background using PM2.
First, navigate to the directory where your Node.js service is located. For example, if your service is located in /var/www/html/dandie/nodejs
, you would navigate to that directory using the following command:
cd /var/www/html/dandie/nodejs