一、安装必要的库
1、安装gcc
gcc-c ++
yum install -y gcc gcc-c ++
2、gzip模块需要 zlib
库
cd /usr/local
wget http://zlib.net/zlib-1.2.11.tar.gz
tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./config
make && make install
3、重写模块需要pcre
库
cd /usr/local
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz
tar -zxvf pcre-8.33.tar.gz
cd pcre-8.33
./configure
make && make install
4、ssl功能需要openssl
库
cd /usr/local
wget http://www.openssl.org/source/openssl-1.0.1j.tar.gz
tar -zxvf openssl-1.0.1j.tar.gz
cd openssl-1.0.1j
./configure
make && make install
二、安装nginx
cd /usr/local
wget http://nginx.org/download/nginx-1.14.0.tar.gz
tar -zxvf nginx-1.14.0.tar.gz
cd nginx-1.14.0
./configure --user=nobody --group=nobody --prefix=/usr/localinx --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-http_ssl_module --with-pcre=/usr/local/pcre-8.33 --with-zlib=/usr/local/zlib-1.2.11 --with-openssl=/usr/local/openssl-1.0.1j
make && make install
三、启动
cd /usr/local/nginx
./sbin/nginx