系统环境:redhat7.6  nginx版本:nginx1.16.1

1、到官网查看最新稳定版的安装包

http://nginx.org/en/download.html

2、查看已经安装nginx的版本以及安装模块

[dip@dip007 nginx]$ /user/local/nginx/sbin/nginx -V
nginx version: nginx/1.16.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module --with-ld-opt=-Wl,-rpath,/usr/local/luajit/lib --add-module=/usr/local/src/ngx_devel_kit-0.2.19 --add-module=/usr/local/src/lua-nginx-module-0.10.9

3、解压最近的安装包,采用原有配置进行编译,但是不要安装!!    简单来说只make   不做 make install

[dip@dip007 cslc]$ tar -xf nginx-1.18.0.tar.gz
[dip@dip007 nginx]$ cd /opt/cslc/nginx-1.18.0/
[dip@dip007 nginx-1.18.0]$ ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module --with-ld-opt=-Wl,-rpath,/usr/local/luajit/lib --add-module=/usr/local/src/ngx_devel_kit-0.2.19 --add-module=/usr/local/src/lua-nginx-module-0.10.9
[dip@dip007 nginx-1.18.0]$ make

4、备份原有执行文件,拷贝新生产的执行文件,升级

[dip@dip007 nginx-1.18.0]$ cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.0622.bak
[dip@dip007 nginx-1.18.0]# cp /opt/cslc/nginx-1.18.0/objs/nginx /usr/local/nginx/sbin/
0]# make upgrade

5、校验程序运行正常,代理服务正常,版本升级成功