该安装脚本为Nginx最新稳定版本(1.18.0)的通用脚本,
在测试机上面(CentOS7最小 纯净版本)已经通过测试。
安装脚本如下:
yum install -y gcc gcc-c++ wget perl
mkdir /web/soft/ -p
cd /web/soft/
wget http://nginx.org/download/nginx-1.18.0.tar.gz
wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
wget http://www.zlib.net/zlib-1.2.11.tar.gz
wget https://www.openssl.org/source/openssl-1.1.1h.tar.gz
tar -zxf nginx-1.18.0.tar.gz
tar -zxf pcre-8.44.tar.gz
tar -zxf zlib-1.2.11.tar.gz
tar -zxf openssl-1.1.1h.tar.gz
cd nginx-1.18.0
./configure \
--prefix=/web/nginx \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_auth_request_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_slice_module \
--with-http_stub_status_module \
--with-stream \
--with-stream_ssl_module \
--with-stream_ssl_preread_module \
--with-pcre=../pcre-8.44/ \
--with-zlib=../zlib-1.2.11/ \
--with-openssl=../openssl-1.1.1h/
make
make install
rm /web/nginx/conf/*.default -rf
通用更新,只需要更新对应的软件包,解压软件包 和 编译参数中对应的路径。
如果长期不更新,忘记参数了,可以通过 /web/nginx/sbin/nginx -V 来查看。

2020/11/10日新增 yum -y install perl,这个忘记了导致openssl编译不过。