Nginx (two): installation of nginx

1. Preparation

  • Open the virtual machine and use the remote connection tool to connect to the linux operating system;
  • Go to the official website of nginx to download the software (http://nginx.org/)

2. Start the nginx installation

2.1 Install pcre dependencies

Step 1: Download pcre compressed files online

cd /usr/src
wget http://downloads.sourceforge.net/project/pcre/pcre/8.37/pcre-8.37.tar.gz

Step 2: Unzip the compressed file

tar -xvf pcre-8.37.tar.gz

Step 3:

#安装gcc
yum -y install gcc-c++  

cd pcre-8.37/
./configure

#编译并且安装
make && make install

#查看版本号
pcre-config --version

2.2 Install other dependencies

#安装openssl、zlib、gcc依赖
yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel

3. Install nginx

cd /usr/src
#解压压缩文件
tar -xvf nginx-1.12.2.tar.gz

cd nginx-1.12.2/
./configure
make && make install
#启动nginx
cd /usr/local/nginx/sbin
./nginx

Insert picture description here

4. Set up the firewall

#查看开放的端口
firewall-cmd --list-all

#设置开放的端口号
firewall-cmd --add-service=http --permanent
sudo firewall-cmd --add-port=80/tcp --permanent

#重启防火墙
firewall-cmd --reload

Guess you like

Origin blog.csdn.net/houwanle/article/details/112061009