参考地址:http://www.cnblogs.com/htian/p/5728599.html
去官网找到PCRE,并下载http://www.pcre.org/
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-10.21.tar.gz
解压:tar -xzvf pcre.tar.gz
进入pcre目录:cd pcre
安装pcre
./configure --prefix /usr/local/pcre2
make
make install
安装pcre-devel(缺少该模块,安装nginx的时候会报错)
yum install pcre-devel
去官网下载zlib库http://www.zlib.net/
wget http://www.zlib.net/zlib-1.2.11.tar.gz
tar -xzvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix /usr/local/zlib
make
make install
去官网下载openssl:https://www.openssl.org/
wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz
tar -xzvf openssl-1.0.2l.tar.gz
cd openssl-1.0.2l
./config
make
make install
去官网下载nginx:http://nginx.org/en/
nginx源码安装文档:http://nginx.org/en/docs/configure.html
wget http://nginx.org/download/nginx-1.13.2.tar.gz
tar -xzvf nginx-1.13.2.tar.gz
cd nginx-1.13.2
./configure --sbin-path=/usr/local/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-pcre=/home/lyh/download/pcre2-10.21 --with-zlib=/home/lyh/download/zlib-1.2.11 --with-openssl=/home/lyh/download/openssl-1.0.2l
make
make install
上面 --sbin-path= 后面是nginx安装到的路径,可以自定义; --conf-path= 以及 --pid-path= 请参考刚才自己定义的目录填写;--with-pcre=以及--with-zlib=,--with-openssl 是刚才自己下载的压缩包解压出来的目录,根据自己的文件名称填写