(1) 安装gcc编译环境
yum -y groupinstall "Development Tools”
yum -y install wget
(2) 下载nginx,以及依赖的pcre,openssl和zlib,需要注意版本,不要使用新版的pcre2。
wget -c http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-8.38.tar.gz
wget -c https://www.openssl.org/source/openssl-1.0.2j.tar.gz
wget -c http://nginx.org/download/nginx-1.10.2.tar.gz
(3) 解压文件
tar -zxvf nginx-1.10.2.tar.gz
tar -zxvf pcre-8.38.tar.gz
tar -zxvf openssl-1.0.2j.tar.gz
(4)编译nginx
cd nginx-1.10.2/
yum install -y zlib-devel
yum install -y gcc gcc-c++
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-pcre=../pcre-8.38 --with-openssl=../openssl-1.0.2j
make
make install
(5)启动nginx