安装nginx时需要多个插件作为依赖,所以在安装nginx时需要安装perl、openssl、zlib和pcre软件。

安装perl

下载perl安装包:wget http://www.cpan.org/src/5.0/perl-5.26.1.tar.gz。

解压安装包:tar -zxvf perl-5.26.1.tar.gz 

创建perl目录将解压后的文件移动到perl目录下:mkdir /usr/local/perl。

设置源码:./Configure -des -Dprefix=/usr/local/perl

编译:make

安装:make install

安装openssl

下载:wget https://www.openssl.org/source/openssl-fips-2.0.16.tar.gz

解压:tar -zxvf openssl-fips-2.0.16.tar.gz

进入目录:cd openssl-fips-2.0.16

配置:./config --prefix=/usr/local/openssl       //安装目录为/usr/local/openssl

编译:make

安装:make install

安装zlib

下载:wget http://zlib.net/zlib-1.2.11.tar.gz

解压:tar -zxvf zlib-1.2.11.tar.gz

进入目录:cd zlib-1.2.11

配置:./configure

编译:make

安装:make install

安装pcre

下载:wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.42.tar.gz

解压:tar -zxvf pcre-8.42.tar.gz

进入目录:cd pcre-8.42

配置:./configure

编译:make

安装:make install

安装nginx

下载:wget http://nginx.org/download/nginx-1.15.0.tar.gz
解压:tar -zxvf nginx-1.15.0.tar.gz 
修改nginx-1.15.0为nginx
进入目录:cd nginx
配置:./configure
编译:make
安装:make install
启动nginx:/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
停止nginx:/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf -s stop