1. NGINX新版的下载
# wget http://nginx.org/download/nginx-1.16.1.tar.gz
2. 获取老版本NGINX的配置
# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.14.2
built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)
built with OpenSSL 1.0.2g 1 Mar 2016
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/pcre-8.35
3. 解压新版NGINX源码包
# tar -zxvf nginx-1.16.1.tar.gz
# cd nginx-1.16.1
4. 配置新版本
# ./configure --prefix=/usr/local/nginx --with-pcre=/usr/local/pcre-8.35 --with-http_stub_status_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --with-http_ssl_module --with-stream
5. 编译新版本
# make
# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE Makefile man objs README src
6. 替换旧版本nginx
# make
# cd objs
# 备份旧版本NGINX
# cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
# mv nginx /usr/local/nginx/sbin/nginx
7. 平滑升级
# make upgrade
8. 检查
# /usr/local/nginx/sbin/nginx -v
nginx version: nginx/1.16.1
# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.16.1
built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)
built with OpenSSL 1.0.2g 1 Mar 2016
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-pcre=/usr/local/pcre-8.35 --with-http_stub_status_module --with-http_v2_module --with-http_gzip_static_module --with-http_sub_module --with-http_ssl_module --with-stream
9. 参考