首先感谢http://www.aledk.com/587.html提供的升级方法
今天看到阿里云漏洞预警:阿里云云盾应急响应中心监测到Nginx近日发布安全更新,披露了三个可能致使服务器拒绝服务的漏洞:CVE-2018-1684三、CVE-2018-16844和CVE-2018-16845。位于Nginx HTTP/2 模块和流媒体MP4模块中。攻击者经过构造特定的恶意HTTP请求,可远程DoS服务器。
解决方案:
升级至Nginx最新安全版本(1.15.6或1.14.1)
那就升级吧。
1,查看安装目录:html
ps -ef | grep nginx | grep master | awk -F" " '{print $11}'
2,查看版本和旧版本编译参数:nginx
/usr/local/nginx/sbin/nginx -V
须要记录下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-openssl=/root/lnmp1.4/src/openssl-1.0.2l --with-ld-opt='-ljemalloc'
3,下载升级版本:服务器
wget http://nginx.org/download/nginx-1.14.1.tar.gz
4,解压下载好的文件阿里云
tar xf nginx-1.14.1.tar.gz
5,并进入文件夹spa
cd nginx-1.14.1
6,进行编译,./configure后面跟的就是第2步查看到的configure argumentscode
./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-openssl=/root/lnmp1.4/src/openssl-1.0.2l --with-ld-opt='-ljemalloc'
7,只编译不安装htm
make,
8,备份旧版本:blog
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old,
9,替换旧的Nginx的执行程序进程
cp objs/nginx /usr/local/nginx/sbin/
10,旧版本中止接收请求,且处理完现有请求后关闭链接,中止(能够查看nginx.conf文件找到pid保存的位置,这里存放的目录是/usr/local/nginx/logs/)
kill -USR2 `cat /usr/local/nginx/logs/nginx.pid`
11,执行完毕后,能够看到pid目录多了存放了旧版本nginx的pid号
ls /usr/local/nginx/logs/
显示:
nginx.pid nginx.pid.oldbin
12,关闭旧进程,完成顺滑升级
kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin`
13,查看升级后的版本
/usr/local/nginx/sbin/nginx -v
成功升级,漏洞修复。