【Linux】Setting app auto run when system boot with PM2
Install PM2 Product Process Manager in Linux
3. The latest stable version of PM2 is available to install via NPM as shown.
4. Once PM2 installed, you can start your node applications using following commands.
Note that, in a production environment, you should start them using PM2, as shown (you may not need sudo command if your app is stored in a location where a normal user has read and write permissions).
Step 4: How to Use and Manage PM2 in Linux
5. To start an application in cluster mode using the
-i
flag to specify the number of instances, for example.6. To list all your node application (process/microservices), run the following command.
7. To monitor logs, custom metrics, process information from all processes by running the following command.
8. To view details of a single Node process as shown, using the process ID or name.
Step 5: How to Manage Node Apps Using PM2 in Linux
9. The following is a list of some common process (single or all) management commands you should take note of.
10. To manage application logs, use the following commands.
11. To manage the PM2 process, use the following commands.
Step 6: Access Node Apps From Web Browser
12. To access all your node application from a remote web browser, first you need to open following ports on your system firewall, to allow client connections to the apps as shown.
13. Then access your apps from a web browser with these URLs:
https://www.tecmint.com/install-pm2-to-run-nodejs-apps-on-linux-server/
Leave a Comment