First of all, it is necessary to buy a server, I use Ali Cloud LAMP 6.1.0 bit operating system. Some of the problems encountered throughout the Vuepress deployment to the server are documented here.

Problems encountered:

  • Server connection

  • Nginx installation configuration

  • The path cannot be accessed after being deployed

Connect to the server using Xshell

1. Go to the official website to purchase or fill in the free license version for home and school users

www.netsarang.com/zh/free-for…

After filling in, you can download it directly

2. Establish a connection

Note: The IP address of the server above is a public IP address

Enter the IP address and password of your account (root in most cases) to go to the following page

When we have finished the project locally and can successfully access the project page, run the NPM run build:docs command

1. Note: Set the base path of the current deployment site to /

2. Put the locally packaged files into the server, I put them in the opt directory

When we go online according to the above steps, we cannot see the page after accessing the public IP address. This is because it is impossible to access a computer’s files through a computer’s IP address. So we also need to configure the server proxy, which I did by configuring Nginx, as well as many other servers besides Nginx. Such as apache.

Nginx installation and configuration

1, in the Xshell terminal, that is, the command line window, enter the command

 yum install nginx
Copy the code

To confirm, type Y and press Enter. When the installation is complete,

2. Run the command

nginx -t
Copy the code

Check the nginx installation directory. Nginx is installed in the /etc/directory by default

3. Enter start nginx service

sudo nginx -c /etc/nginx/nginx.conf
Copy the code

/etc/nginx/nginx.conf is the default installation location

4. If the following figure is displayed during startup

You can use sudo fuser -k 80/ TCP to release the nginx service again

5. On the CLI, run the CD /etc/nginx command to switch to the nginx directory, and then run cat nginx.conf to view the current nginx configuration file.

Conf in the nginx directory, enter vim nginx.conf to enter the nginx configuration editing mode, and then press the I key. When — INSERT– appears in the lower left corner of the command line, use the mouse up and down key to modify the file.

7. After modifying the Nginx configuration file, press ESC to exit the editing mode, enter :wq, and press Enter to save the modification and exit. After modifying the nginx configuration file,

8. Enter nginx -s reload to restart the nginx configuration. If the restart fails, run the nginx -c /etc/nginx/nginx.conf command to restart the system again.

Iv. Aliyun background configuration firewall

1. Add the port number configured in nginx.conf to the security/firewall configuration of Ali Cloud server as shown in the figure below:

2. After saving successfully, at this time, we can see our project la, la, la, la ~ through ali Cloud public IP access

Welcome to my component library! http://47.100.68.20:8080/

If there is any wrong place, welcome to guide.