CentOS 7.2 build nginx web server and deploy uniapp project

Time:2021-7-15

Panther came from a Xiaobai. Although he is still Xiaobai now, I take it from the people and share what I have learned with you from time to time. In the last blog, I talked about the multi device co display of thingsboard, because now he is in the stage of learning. He has more things to contact and also more miscellaneous. I hope my article can help you

one Buy Tencent cloud

https://cloud.tencent.com/

Products – cloud server – buy now – quick configuration – region – entry configuration – CentOS 7.2 – purchase

在这里插入图片描述

Case console https://console.cloud.tencent.com/cvm

在这里插入图片描述

Modify security group open port

在这里插入图片描述

Because all ports can be connected at the beginning, it is modified to the specified port connection here

在这里插入图片描述

reset password

在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述

**two ** Connect via tools – xshell

Host name -- fill in the host name you purchased
123.175.167.214
user name
root
Password: email number
Port: 22

在这里插入图片描述 

Upload nginx to the home folder of CentOS

在这里插入图片描述

Connect CentOS through xshell and input command
Enter the root directory
cd /
View all directories
ll
Go to the home directory
cd home/
ll

Install nginx. When nginx is not installed, visit 123.175.167.214

在这里插入图片描述

Decompress nginx in the home directory of xshell
tar -zxvf nginx-1.12.0.tar.gz
Build environment for using nginx
yum -y install gcc-c++
yum -y install pcre-devel
yum -y install zlib-devel
yum -y install openssl openssl-devel
After the environment is installed, enter the nginx folder
ll
cd nginx-1.12.0/
Compile nginx without spaces
./configure
make
make install
Installation successful
/usr/local/nginx

在这里插入图片描述

Enter the successfully installed directory
cd /usr/local/
ll
cd /usr/local/nginx/
ll

在这里插入图片描述

View current location
pwd
start nginx 
cd sbin/
ll
./nginx

在这里插入图片描述 在这里插入图片描述

**three **
Deploying uniapp
Create a new file in the / usr / local / nginx / directory of CentOS
movie
Put all H5 pages under movie

在这里插入图片描述

Configure the published address to nginx,
Check whether the file is uploaded successfully!
cd /usr/local/nginx/
ll
cd movie/
ll
cd h5/
ll
Back again
cd /usr/local/nginx/
Because all the configurations are in conf under nginx
cd conf/
ll
Find the nginx. Conf configuration file and modify it
vim nginx.conf

在这里插入图片描述

Enter the SBIN directory to run
cd ..
cd sbin/
Perform the test
./nginx -t
Restart the server
./nginx -s reload
Test OK, test success

在这里插入图片描述 

**four ** Here, the purchase of Tencent cloud, the construction of web server and the H5 deployment of uniapp are over

在这里插入图片描述

summary

The above is the project of centos7.2 building nginx web server and deploying uniapp introduced by Xiaobian. I hope it can help you. If you have any questions, please leave me a message and Xiaobian will reply you in time. Thank you very much for your support to developer!
If you think this article is helpful to you, please reprint, please indicate the source, thank you!