Use the online configuration of Alibaba Cloud server

1. Configuration commands during installation

1. yum install nginx install server agent
Insert picture description here
2. Check the version of node and npm

The original version is low, so you need to update the version.
Insert picture description here
Enter npm in -g to install the n module-------Enter n stable to update all
Insert picture description here
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
Insert picture description here
will be replaced on the map - and then upload this file to nginx file
Insert picture description here
5 to create a static file in the home below , And introduce an index.js file, the content of the file is as follows
Insert picture description here
Insert picture description here
6. In cd home, install express—input npm i express—save
Insert picture description here
Insert picture description here
node index.js to start the server
7. Install pm2 deployment project—input npm i pm2 -g
Insert picture description here

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

Guess you like

Origin blog.csdn.net/javaScript1997/article/details/109598262