Nginx 平滑升級(jí)的實(shí)現(xiàn)(拒絕服務(wù)漏洞)
前言
Nginx 拒絕服務(wù)漏洞(CVE-2019-9513、CVE-2019-9511)
- 將 Nginx 升級(jí)到 1.16.1、1.17.3 及以上版本,下載地址:https://nginx.org/en/download.html
- 若漏洞的檢測(cè)結(jié)果中存在漏洞修復(fù)版本,則將漏洞檢測(cè)結(jié)果中的軟件包升級(jí)到對(duì)應(yīng)漏洞修復(fù)版本及以上。
參照安全補(bǔ)丁功能中該漏洞的修復(fù)命令進(jìn)行升級(jí),或者參照以下修復(fù)命令進(jìn)行升級(jí):
CentOS/RHEL/Oracle Linux : sudo yum update -y 需要升級(jí)的軟件包名(參考檢測(cè)結(jié)果)
SUSE : sudo zypper update -y 需要升級(jí)的軟件包名(參考檢測(cè)結(jié)果)
Ubuntu/Debian : sudo apt-get update && sudo apt-get install --only-upgrade -y 需要升級(jí)的軟件包名(參考檢測(cè)結(jié)果)
例:若漏洞的檢測(cè)結(jié)果中主機(jī)系統(tǒng)為 Ubuntu 16.04,軟件包名稱(chēng)為 nginx,當(dāng)前安裝版本為 1.10.3-0ubuntu0.16.04.4,對(duì)應(yīng)漏洞修復(fù)版本為1.10.3-0ubuntu0.16.04.5,則漏洞修復(fù)命令為 sudo apt-get update && sudo apt-get install --only-upgrade -y nginx-core nginx
一、CentOS 7 Nginx1.12.2平滑升級(jí)到新版本nginx-1.21.5
nginx下載:http://nginx.org/download/
二、操作步驟
1.查看當(dāng)前Nginx版本信息
[root@web ~]# /usr/local/nginx/sbin/nginx -V nginx version: nginx/1.12.2 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx --with-pcre --with-openssl=/tmp/openssl-1.1.0e --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-http_image_filter_module --with-mail --with-threads --with-mail_ssl_module --with-stream_ssl_module
2.下載nginx-1.21.5版本到/usr/local/下,解壓并進(jìn)入解壓后的目錄
[root@nginx ~]# cd /usr/local/ [root@nginx ~]# wget http://nginx.org/download/nginx-1.21.5.tar.gz [root@nginx ~]# tar xf nginx-1.21.5.tar.gz [root@nginx ~]# cd nginx-1.21.5
3.配置nginx
查看nginx版本的時(shí)候,configure arguments后面有一大串模塊,這也是你第一次安裝nginx時(shí)所指定的模塊,升級(jí)的時(shí)候也要同時(shí)指定,也可以添加其他模塊
[root@nginx nginx-1.21.5]# ./configure \ --prefix=/usr/local/nginx \ --user=nginx \ --group=nginx \ --with-pcre \ --with-openssl=/tmp/openssl-1.1.0e \ --with-http_ssl_module \ --with-http_v2_module \ --with-http_realip_module \ --with-http_addition_module \ --with-http_sub_module \ --with-http_dav_module \ --with-http_flv_module \ --with-http_mp4_module \ --with-http_gunzip_module \ --with-http_gzip_static_module \ --with-http_random_index_module \ --with-http_secure_link_module \ --with-http_stub_status_module \ --with-http_auth_request_module \ --with-http_image_filter_module \ --with-mail \ --with-threads \ --with-mail_ssl_module \ --with-stream_ssl_module \ && make
make完以后,不需要執(zhí)行make install,否則會(huì)覆蓋安裝,nginx服務(wù)會(huì)出現(xiàn)各種問(wèn)題
不中斷nginx web服務(wù)器的正常運(yùn)行稱(chēng)之為平滑升級(jí),先重命名之前的nginx二進(jìn)制文件
[root@nginx nginx-1.21.5]# mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
拷貝剛編譯新生產(chǎn)的Nginx二進(jìn)制文件到/usr/local/nginx/sbin/目錄
[root@nginx nginx-1.21.5]# cp /usr/local/nginx-1.21.5/objs/nginx /usr/local/nginx/sbin/
4.開(kāi)始執(zhí)行升級(jí)
[root@web nginx-1.21.5]# make upgrade /usr/local/nginx/sbin/nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful kill -USR2 `cat /usr/local/nginx/logs/nginx.pid` sleep 1 test -f /usr/local/nginx/logs/nginx.pid.oldbin kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin`
5.查看nginx版本信息
[root@web nginx-1.13.3]# /usr/local/nginx/sbin/nginx -V nginx version: nginx/1.21.5 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) built with OpenSSL 1.1.0e 16 Feb 2017 TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx --with-pcre --with-openssl=/tmp/openssl-1.1.0e --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-http_image_filter_module --with-mail --with-threads --with-mail_ssl_module --with-stream_ssl_module
總結(jié)
報(bào)錯(cuò)0
nginx unknown directive “stream”
nginx默認(rèn)安裝的時(shí)候沒(méi)有加載stream模塊
需要重新對(duì)源文件進(jìn)行編譯、安裝,通過(guò)添加–with-stream參數(shù)指定安裝stream模塊
./configure --with-stream
make & make install
再次檢查nginx.conf配置文件,確認(rèn)配置無(wú)語(yǔ)法錯(cuò)誤后,再次嘗試啟動(dòng)服務(wù)。
nginx -t 檢查配置文件是否正確
nginx -c 指定啟動(dòng)的配置文件
報(bào)錯(cuò)1
./configure: error: the HTTP XSLT module requires the libxml2/libxslt
libraries. You can either do not enable the module or install the libraries.
原因:缺少依賴(lài)
解決:
[root@vm-3 nginx-1.21.5]# yum -y install libxml2 libxslt-devel
再次配置
報(bào)錯(cuò)2
./configure: error: the HTTP image filter module requires the GD library.
You can either do not enable the module or install the libraries.
解決:安裝依賴(lài)
yum -y install gd-devel
再次配置
報(bào)錯(cuò)3
./configure: error: perl module ExtUtils::Embed is required
解決:
yum -y install perl-devel perl-ExtUtils-Embed
再次配置
報(bào)錯(cuò)4
./configure: error: the GeoIP module requires the GeoIP library. You can either do not enable the module or install the library.
解決:
yum -y install GeoIP GeoIP-devel GeoIP-data
再次配置
報(bào)錯(cuò)5
./configure: error: the Google perftools module requires the Google perftools
library. You can either do not enable the module or install the library.
到此這篇關(guān)于Nginx 平滑升級(jí)的實(shí)現(xiàn)(拒絕服務(wù)漏洞)的文章就介紹到這了,更多相關(guān)Nginx 平滑升級(jí)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Nginx跨域訪(fǎng)問(wèn)配置方式(Web反向代理跨域訪(fǎng)問(wèn)配置)
這篇文章主要介紹了Nginx跨域訪(fǎng)問(wèn)配置方式(Web反向代理跨域訪(fǎng)問(wèn)配置),具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-06-06Nginx進(jìn)行域名重寫(xiě)和泛域名解析配置的方法
這篇文章主要介紹了Nginx進(jìn)行域名重寫(xiě)和泛域名解析配置的方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-08-08nginx開(kāi)啟https配置之后網(wǎng)頁(yè)無(wú)法訪(fǎng)問(wèn)的問(wèn)題處理解決
最近新購(gòu)服務(wù)器部署nginx之后按照之前的方式部署前端項(xiàng)目并配置https之后訪(fǎng)問(wèn)頁(yè)面無(wú)法顯示,本文主要介紹了nginx開(kāi)啟https配置之后網(wǎng)頁(yè)無(wú)法訪(fǎng)問(wèn)的問(wèn)題處理解決,具有一定的參考價(jià)值,感興趣的可以了解一下2023-11-11Nginx配置如何區(qū)分PC或手機(jī)訪(fǎng)問(wèn)不同域名
這篇文章主要介紹了Nginx配置如何區(qū)分PC或手機(jī)訪(fǎng)問(wèn)不同域名,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-10-10Nginx訪(fǎng)問(wèn)FTP服務(wù)器文件的時(shí)效性/安全校驗(yàn)的方法
nginx的實(shí)現(xiàn)方式在校驗(yàn)失敗的時(shí)候頁(yè)面返回error image,跳轉(zhuǎn)的是420 error_page,成功的時(shí)候會(huì)訪(fǎng)問(wèn)FTP文件服務(wù)器的路徑,反正圖片到頁(yè)面展示,這篇文章主要介紹了Nginx訪(fǎng)問(wèn)FTP服務(wù)器文件的時(shí)效性/安全校驗(yàn),需要的朋友可以參考下2023-12-12Nginx捕獲并自定義proxy_pass返回的錯(cuò)誤問(wèn)題
這篇文章主要介紹了Nginx捕獲并自定義proxy_pass返回的錯(cuò)誤問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-06-06