摘要:生级nginx版本
目录
前言
由于nginx遇到版本漏洞,故需要进行升级,再生产环境条件下,能够进行平滑升级!!!
一、nginx升级原因?
nginx 存在安全漏洞(CVE-2021-23017),受影响版本:0.6.18-1.20.0,故将nginx版本升级至版本nginx-1.20.2
二、操作步骤
1.下载nginx源码包
上传nginx包到服务器
2.查看当前使用版本信息
进入当前使用的nginx版本sbin目录下:
./nginx -V
复制查询出来的configure arguments内容,后面需引用
configure arguments: --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module
3.对nginx文件进行备份
mv nginx nginx-1-1.16.1
4.解压新版的nginx包
tar -xf nginx-1.20.2.tar.gz
5.进入到nginx-1.20.2目录下
cd /data/nginxcluster/nginx-1.20.2/
[root@hos nginx-1.20.2]# ./configure --prefix=/data/nginxcluster/nginx-1 --add-module=/data/nginxcluster/ngx_devel_kit-0.3.1 --add-module=/data/nginxcluster/lua-nginx-module-0.10.15
//只做make操作
[root@hos nginx-1.20.2]# make
[root@host nginx-1.20.2]# cd objs/
//复制文件到旧的nginx的sbin文件夹下
[root@host objs]# cp nginx /data/nginxcluster/nginx-1/sbin/
//查看nginx状态
[root@host sbin]# /data/nginxcluster/nginx-1/sbin/nginx -t
//查看是否升级成功
[root@host sbin]# /data/nginxcluster/nginx-1/sbin/nginx -V
总结
提示:看到新版本就成功升级了