1. Configuration commands during installation
1. yum install nginx install server agent
2. Check the version of node and npm
The original version is low, so you need to update the version.
Enter npm in -g to install the n module-------Enter n stable to update all
3. Install nginx,
enter yum install nginx and press Enter
4, the installation is successful, up / down to go etc nginx - nginx.conf double-click [] will be downloaded to your desktop - click to open
will be replaced on the map - and then upload this file to nginx file
5 to create a static file in the home below , And introduce an index.js file, the content of the file is as follows
6. In cd home, install express—input npm i express—save
node index.js to start the server
7. Install pm2 deployment project—input npm i pm2 -g
Question 1: The web page cannot be opened after restarting the server
Solution : Restart nginx and
shut down pm2—pm2 stop all—and then systemctl restart nginx—pm2 list—pm2 start index.js