1、下载安装源码wget http://nginx.org/download/nginx-1.16.1.tar.gz
2、安装依赖环境
yum install gcc gcc-c++ automake autoconf libtool make
3、安装prce、zlib。前者为了重写rewrite,后者为了gzip压缩
https://ftp.pcre.org/pub/pcre/ 下载最新的 PCRE 源码包
cd /usr/local/src/
wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
4、安装nginx
wget http://nginx.org/download/nginx-1.16.1.tar.gz
./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_gzip_static_module --with-http_stub_status_module --with-file-aio --with-http_realip_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.44 --with-zlib=/usr/local/src/zlib-1.2.11
make && make install
5、安装完成,启动测试是否能访问,启动命令/usr/local/nginx/nginx