Tencent cloud Centos7 install nginx

Install Nginx

 

Reference: https://docsxyz.com/wiki/nginx/install

Step 1: Installation related components

yum install -y openssl*
yum -y install ncurses-devel
yum -y install gcc-c++
yum -y install gcc gcc-c++ zlib zlib-devel openssl openssl-devel pcre pcre-devel
  • gcc: Compiler assembly, including C, C ++, etc.
  • zlib: data compression library
  • openssl: https secure transmission protocol, the default is not open
  • pcre: regular expression library

Step 2: emerge Nginx

# Get nginx. If wget is not installed, using the install wget -Y yum 
wget https://nginx.org/download/nginx-1.17.1.tar.gz 
 
# decompression, unzip the file display zxvf 
the tar-1.17.1.tar.gz zxf Nginx 
 
# nginx source files into the directory 
cd nginx-1.17.1 
 
# compiler, the default https is not open, you need to add-http_ssl_module --with 
./configure --with-http_ssl_module 
 
# install Nginx 
the make && the make install 
 
# start Nginx 
/ usr / local / nginx / sbin / nginx

Step 3: Configure the firewall

Centos 7 permanently open port 80:

# Check firewall status 
Firewall-cmd - State
 # turn off the firewall 
systemctl STOP firewalld.service
 # to open the firewall 
systemctl Start firewalld.service
 # permanently open port 80, 
firewall-cmd --zone = public --add- port = 80 / tcp - Permanent
 # update the firewall rules 
firewall-cmd --reload

running result

Guess you like

Origin www.cnblogs.com/wangcongxing/p/12520170.html