1、确认当前nginx版本信息
进入nginx安装目录下, 执行
./sbin/nginx -V
可以看到当前nginx的版本信息
nginx version: nginx/1.17.1
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
built with OpenSSL 1.1.1i 8 Dec 2020
TLS SNI support enabled
configure arguments: --prefix=/extusr/software/nginx --with-http_ssl_module --with-stream --with-pcre=/extusr/software/nginx-install-package/pcre-8.42 --with-zlib=/extusr/software/nginx-install-package/zlib-1.2.11 --with-openssl=/extusr/software/nginx-install-package/openssl-1.1.1i --add-module=/extusr/software/nginx-install-package/ngx_http_proxy_connect_module-master
2、去nginx官网下载想要升级的tar包
nginx官方下载地址 服务器可以连公网的话可以直接wget下载
wget http://nginx.org/download/nginx-1.21.6.tar.gz
3、去github获取对应nginx版本的ngx_http_proxy_connect_module-master
https://github.com/chobits/ngx_http_proxy_connect_module
4、安装包解压
tar zxvf nginx-1.21.6.tar.gz
解压之后进入安装目录
cd nginx-1.21.6
5、安装文件编译
patch -p1 < /extusr/software/nginx-install-package/ngx_http_proxy_connect_module-master/patch/proxy_connect_rewrite_102101.patch
./configure --prefix=/extusr/software/nginx --with-http_ssl_module --with-stream --with-pcre=/extusr/software/nginx-install-package/pcre-8.42 --with-zlib=/extusr/software/nginx-install-package/zlib-1.2.11 --with-openssl=/extusr/software/nginx-install-package/openssl-1.1.1i --add-module=/extusr/software/nginx-install-package/ngx_http_proxy_connect_module-master
make
6、升级NG
mv /extusr/software/nginx/sbin/nginx /extusr/software/nginx/sbin/nginx-1.17.1
cp objs/nginx /extusr/software/nginx/sbin/
kill -USR2 `cat /extusr/software/nginx/logs/nginx.pid`
kill -WINCH `cat /extusr/software/nginx/logs/nginx.pid.oldbin`
7、验证升级后的版本
执行
./sbin/nginx -V
可以看到nginx的版本信息已成功升级为1.21.6。至此,大功告成!
nginx version: nginx/1.21.6
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
built with OpenSSL 1.1.1i 8 Dec 2020
TLS SNI support enabled
configure arguments: --prefix=/extusr/software/nginx --with-http_ssl_module --with-stream --with-pcre=/extusr/software/nginx-install-package/pcre-8.42 --with-zlib=/extusr/software/nginx-install-package/zlib-1.2.11 --with-openssl=/extusr/software/nginx-install-package/openssl-1.1.1i --add-module=/extusr/software/nginx-install-package/ngx_http_proxy_connect_module-master
|