In the actual project deployment, our server needs to start the node service automatically when it starts. Previously, it was started with a command that comes with Liunx. But with the background microservices more and more. Each time a new program is released. It's too much trouble to modify the script. And then replaced by PM2 to do.
1. First install the PM2
NPM install-g PM2
2. Build the configuration file
PM2 Ecosystem build completed there will be a ecosystem.config.js file,
3. Modify the configuration file
Edit Ecosystem.config.js
。 The main needs to configure the program name, the program startup script. You can do it.
4. Start the configuration file
PM2 Startorrestart Ecosystem.config.js
5. View the startup situation
PM2 List
The delegate program started successfully.
The script Start command enables multiple node versions to be supported with NVM.
PM2 Deploying multiple Nodejs project configuration Tutorials