Recently, I want to start a personal blog. Probably made a simple page, and then Ali Cloud rented a server. We’re almost ready.

Next comes knowledge blind deployment in order to be readily accessible in the browser. I looked up the information and found that using the pagoda panel to deploy is really good.

1. First of all, we found the instance we created in the console of Ali Cloud and clicked Remote Connection.

Then we select Workbench remote connection as shown below

To connect, you need to enter the instance password as shown in the following figure

After login, we can directly download the pagoda panel in the operating system through the command, use the following command, select Y, enter to continue,

Yum install wget – y && wget – O the sh download. Bt. Cn/install/ins… && sh install.sh

After the installation is completed, we will get the access address and login name and password of the pagoda panel. We can access it by entering the access address in the browser.

For the first login, you will be asked to select the relevant configuration as shown in the figure below. Personally, you will choose LNMP, and then check Compile and install for installation.

It should be noted that the port of the pagoda is 8888. If you change it, you need to click Security on the panel to allow configuration.

Then we go to the app store to download the tools. The database I use is mongoDB, so download mongoDB and pM2 manager, which is used to start the later code, and also download Nginx

Project configuration

The default is port 80, server_name, enter the public IP address on Aliyun, root is the package code address, and set the proxy in location, the interface starting with API will be proxy to 127.0.0.1:8886. This address is actually the service address that we use node to open. Of course, this address can be set by yourself

Then we package the front-end code. Note that the proxy field of public IP plus API needs to be configured in the interface public address of AXIOS.

After packaging, we uploaded the server, clicked the file in the pagoda panel, entered the/WWW /wwwroot /dist folder, compressed the dist folder and uploaded it. After uploading, we could see our static website in the browser address bar. If the interface was used in the project, we also needed to configure the back-end service.

We can create a server folder under Dist and upload our server-side code into it. Then we click the PM2 manager in the pagoda panel, check the version of the node used, select the corresponding version, and download the dependency package used in module management.

Note that the node file, when we introduce the package use, the path needs to be spliced on the following path, this version according to their own node version to change

Const express = the require (‘/WWW/server/NVM/versions/node/v12.18.2 / lib/node_modules/express ‘);

We also need to select our service startup file, as shown in the picture below. In addition, the port we listen on is the port of my Node service

To complete the above steps node service can be started as well, we need the pagoda panel to click on the site, find our create site, and then click on Settings, which also has configuration, configure the reverse proxy. At this time, our interface can be used. In addition, I encountered a 404 problem during configuration. After checking for a long time, I found that there was an extra/API in the path matching address in Express, which resulted in a failure to match.