超碰中文网,91久久精品日日躁夜夜躁欧美,一区二区三区精品道,一区二区国产在线观看,亚洲精品中文字幕乱码一区二区,天天看片高清影视在线观看,久久99精品久久久久蜜桃,久久成人影视

VPS參考測評推薦
專注分享VPS主機優(yōu)惠信息
衡天云優(yōu)惠活動
熱網(wǎng)互聯(lián)2026年促銷活動
hostkvm優(yōu)惠促銷活動
zji優(yōu)惠促銷活動
QQGNET優(yōu)惠促銷活動
QQGNET優(yōu)惠促銷活動

寶塔面板安裝ngx_waf,高性能Nginx防火墻模塊自帶類似cf的5秒防護罩,抵御cc攻擊

主機參考:VPS測評參考推薦/專注分享VPS服務(wù)器優(yōu)惠信息!若您是商家可以在本站進行投稿,查看詳情!此外我們還提供軟文收錄、PayPal代付、廣告贊助等服務(wù),查看詳情!
我們發(fā)布的部分優(yōu)惠活動文章可能存在時效性,購買時建議在本站搜索商家名稱可查看相關(guān)文章充分了解該商家!若非中文頁面可使用Edge瀏覽器同步翻譯!PayPal代付/收錄合作

ngx_waf,新開發(fā)的便捷高性能的Nginx防火墻模塊。 ngx_waf 的優(yōu)點包括:

功能齊全:“網(wǎng)絡(luò)應(yīng)用防火墻”的所有基本功能。

易于安裝:缺少依賴項時會自動提供解決方案。

易于使用:配置說明簡單易懂,不用看文檔也能猜到是什么意思。

高性能:經(jīng)過更極端的測試,啟動該模塊后RPS(每秒請求數(shù))降低了約4%。測試描述和結(jié)果請參考文檔。

寶塔面板安裝ngx_waf,高性能Nginx防火墻模塊自帶類似cf的5秒防護罩,抵御cc攻擊-主機參考

1.簡介

項目:https://github.com/ADD-SP/ngx_waf/

2.部署方式一

本文采用兩種方式部署模塊,首先介紹常規(guī)的靜態(tài)編譯方式。另外,作者還提供了Docker的安裝方法,但不在本文討論范圍內(nèi)。

2.1進入寶塔面板的nginx目錄

cd /www/server/nginx/sbin/

2.2備份寶塔nginx

cp nginx nginx.bak

2.3 查看當前nginx加載位置的模塊,這些模塊在編譯加載的PageSpeed模塊時仍然需要加載(以下路徑為寶塔默認nginx路徑,請更改其他面板的路徑自己確定)進入nginx的編譯目錄,命令如下:

cd /www/server/nginx/src

2.4 查看寶塔編譯的nginx加載模塊。這些模塊在重新編譯和加載新模塊時仍然需要加載

nginx -V

注意這個命令是大寫的V,如果小寫的v不顯示模塊,這里會顯示所有編譯好的模塊。將 ./configure arguments: 后的內(nèi)容復制到記事本以備后用。莫濤來了:

--user=www --group=www --prefix=/www/server/nginx --add-module=/www/server/nginx/src/ngx_devel_kit --add-module=/www/server/ nginx/src/lua_nginx_module --add-module=/www/server/nginx/src/ngx_cache_purge --add-module=/www/server/nginx/src/nginx-sticky-module --with-openssl=/www/ server/nginx/src/openssl --with-pcre=pcre-8.43 --with-http_v2_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_stub_status_module --with- http_ssl_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_gunzip_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with- ld-opt=-Wl,-E --with-cc-opt=-Wno-error --with-ld-opt=-ljemalloc --with-http_dav_module --add-module=/www/server/nginx/src /nginx-dav-ext-module

2.5 添加ngx_waf防火墻模塊,并在所有模塊的末尾添加以下模塊。

--add-module=/www/server/nginx/src/ngx_waf --with-cc-opt='-std=gnu99'

2.6 比如如果是寶塔,直接按如下回車即可。

./configure --user=www --group=www --prefix=/www/server/nginx --add-module=/www/server/nginx/src/ngx_devel_kit --add-module=/www /server/nginx/src/lua_nginx_module --add-module=/www/server/nginx/src/ngx_cache_purge --add-module=/www/server/nginx/src/nginx-sticky-module --with-openssl= /www/server/nginx/src/openssl --with-pcre=pcre-8.43 --with-http_v2_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_stub_status_module- -with-http_ssl_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_gunzip_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module- -with-ld-opt=-Wl,-E --with-cc-opt=-Wno-error --with-ld-opt=-ljemalloc --with-http_dav_module --add-module=/www/server/ nginx/src/nginx-dav-ext-module --add-module=/www/server/nginx/src/ngx_waf --with-cc-opt='-std=gnu99'

2.7 以上命令執(zhí)行完畢后,輸入編譯命令如下:

制作

編譯安裝過程大概需要5分鐘,還是有點長。完成后,將系統(tǒng)中原有的nginx替換為重新編譯生成的nginx文件。

2.8停止nginx

服務(wù)nginx停止

2.9刪除原來的nginx,操作前請確保你的nginx已經(jīng)備份

rm -rf /www/server/nginx/sbin/nginx

2.10復制剛編譯好的nginx

cp /www/server/nginx/src/objs/nginx /www/server/nginx/sbin/

2.11啟動nginx

服務(wù)nginx啟動

2.12 使用nginx -V命令檢查模塊是否完整。編譯成功的效果如下:

3.部署方式二

這是一個編譯模塊的方法。

3.1 如果安裝nginx,需要從軟件商店卸載,然后重新安裝。注意要選擇編譯方式安裝。

3.2選擇自定義安裝模塊,看圖:

注意具體參數(shù)填寫如下:

模塊名稱:ngx_waf

模塊描述:ngx_waf

模塊參數(shù):

--add-module=/www/server/nginx/src/ngx_waf --with-cc-opt='-std=gnu99'

前腳本:

mkdir -p /www/server/nginx/src cd /www/server/nginx/src git clone -b master https://github.com/ADD-SP/ngx_waf.git cd ngx_waf git clone https:/ /github.com/libinjection/libinjection.git inc/libinjection

3.3 編輯好后提交,如圖:

提交后,等待安裝成功。

3.4 如果遇到錯誤,一般就是這個錯誤,

錯誤:在 /root/ngx_waf 中添加模塊檢查 uthash 庫...未找到 ./configure:錯誤:ngx_http_waf_module 模塊需要 uthash 庫。

此錯誤表示缺少 uthash 庫。通過 yum 或 apt 安裝。

centos: yum install uthash-devel ubuntu: apt install uthash-dev

3.5 安裝成功效果如下: nginx -V 檢查! !看到 ngx_waf 模塊現(xiàn)已可用,您就大功告成了。

配置參數(shù):--user=www --group=www --prefix=/www/server/nginx --add-module=/www/server/nginx/src/ngx_devel_kit --add-module=/www /server/nginx/src/lua_nginx_module --add-module=/www/server/nginx/src/ngx_cache_purge --add-module=/www/server/nginx/src/nginx-sticky-module --with-openssl= /www/server/nginx/src/openssl --with-pcre=pcre-8.43 --with-http_v2_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_stub_status_module- -with-http_ssl_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_gunzip_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module- -with-ld-opt=-Wl,-E --with-cc-opt=-Wno-error --with-ld-opt=-ljemalloc --with-http_dav_module --add-module=/www/server/ nginx/src/nginx-dav-ext-module --add-module=/www/server/nginx/src/ngx_waf --with-cc-opt='-std=gnu99'

4.網(wǎng)站配置及效果展示

4.1 如果你沒有網(wǎng)站,可以新建一個,點擊寶塔的網(wǎng)站配置文件,在服務(wù)器部分找個地方放。顯示代碼如下: 此代碼啟用waf自帶的5秒屏蔽功能。

waf on; # 是否啟用模塊waf_rule_path /www/server/nginx/src/ngx_waf/assets/rules/; # 模塊規(guī)則 waf_mode STD !CC; # 開啟普通模式,關(guān)閉CC保護 waf_cache capacity=50; # 緩存在uri=/under-attack.html上配置waf_under_attack; # 配置5秒盾

4.2 以上需要注意,把測試用的5秒屏蔽html文件復制到你站點的根目錄:

cp /www/server/nginx/src/ngx_waf/assets/under-attack.html /www/wwwroot/imotao.com

如果不需要命令,直接按照路徑復制這個文件到你網(wǎng)站的根目錄即可。

4.3 測試效果,如果配置正確,此時打開網(wǎng)站,會有5秒的屏蔽效果提示。

當然,這只是一個靜態(tài)頁面。你可以隨意修改。如果有特別好的修改,不妨貢獻一份。

5.終于

以上教程簡單展示了接下來5秒開啟屏蔽功能。本教程基于寶塔部署。有兩種方法。建議使用第二種方法,但方法取決于您的需要。

其他更多功能請看官方文檔:

https://add-sp.github.io/ngx_waf/zh-cn/advance/directive.html

這幾篇文章你可能也喜歡:

本文由主機參考刊發(fā),轉(zhuǎn)載請注明:寶塔面板安裝ngx_waf,高性能Nginx防火墻模塊自帶類似cf的5秒防護罩,抵御cc攻擊 http://m.k2270.com/65964.html

【騰訊云】領(lǐng)8888元采購禮包,搶爆款云服務(wù)器 每月 9元起,個人開發(fā)者加享折上折!
打賞
轉(zhuǎn)載請注明原文鏈接:主機參考 » 寶塔面板安裝ngx_waf,高性能Nginx防火墻模塊自帶類似cf的5秒防護罩,抵御cc攻擊
主機參考僅做資料收集,不對商家任何信息及交易做信用擔保,購買前請注意風險,有交易糾紛請自行解決!請查閱:特別聲明

評論 搶沙發(fā)

評論前必須登錄!