1、创建文件夹并进入文件夹
mkdir /home/npf/nginx-server
2、在nginx-server下放入安装包
pcre-8.38.tar.gz
openssl-1.0.2n.tar.gz
zlib-1.2.11.tar.gz
nginx-1.18.0.tar.gz
3、安装 pcre-8.38
tar -xvf pcre-8.38.tar
进入 /home/npf/nginx-server/pcre-8.38
./configure
make
make install
4、安装 openssl-1.0.2n
tar -xvf openssl-1.0.2n.tar
进入/home/npf/nginx-server/openssl-1.0.2n
./config
make
make install
5、安装zlib-1.2.11
tar -xvf zlib-1.2.11.tar
进入/home/npf/nginx-server/zlib-1.2.11
./configure
make
make install
6、安装nginx-1.18.0(./configure命令下文件位置不能错)
tar -zxvf nginx-1.18.0.tar.gz
进入/home/npf/nginx-server/nginx-1.18.0
./configure –prefix=/home/npf/nginx-server –with-pcre=/home/npf/nginx-server/pcre-8.38 –with-openssl=/home/npf/nginx-server/openssl-1.0.2n –with-zlib=/home/npf/nginx-server/zlib-1.2.11
make
make install
7、查看安装是否成功
cd /home/npf/nginx-server/sbin
./nginx -v
提示nginx版本,说明安装成功nginx version: nginx/1.18.0