Install nginx in Linux (CentOS)

                                               #  Linux中安装nginx操作说明
   说明:
           我的环境是Centos8.2或者Centos7.x我都试过都可以.
             注意 你下载解压完成之后 ,进行编译时才算是安装. 
             具体安装的位置需要whereis nginx命令来查找 
             而原来解压的nginx文件可以在执行make install  成功之后删除
             
             **重要: 第一步的这四个东西必须要都执行一边.并保证执行成功. 不然无法编译nginx**

Step 1: First install PCRE pcre-devel and Zlib, GCC, OpenSSL. When configuring nginx, the installation commands will be used as follows:

yum install -y pcre pcre-devel

yum install -y zlib zlib-devel

yum install -y make

yum install gcc-c++

yum install -y openssl openssl-devel

Step 2: Install nginx, 1.14.0
download address: http://nginx.org/en/download.html

#Unzip and enter the nginx directory

tar -zxvf nginx-1.14.0.tar.gz
cd nginx-1.14.0

#The command after initializing nginx configuration is to make nginx also support tcp forwarding.

./configure --with-stream --with-stream_ssl_module --with-http_stub_status_module

Compile and install

make
make install

Find installation path

whereis nginx

Enter the sbin directory, you can see that there is an executable file nginx, just execute ./ and it will be OK.
Note that after you download and decompress, it is not installed until you compile it. The specific installation location requires the whereis nginx command to find the originally decompressed nginx. The file can be deleted after executing make install successfully.

Guess you like

Origin blog.csdn.net/qq_37120477/article/details/131909048