nginx規則屏蔽國外的垃圾蜘蛛
nginx規則屏蔽國外的垃圾蜘蛛,解決被國外蜘蛛爬紅服務器的問題,以下spider代表開放國內的所有蜘蛛,在服務器網站設置的偽靜態規則最前面加上以下代碼:
set $ly_cahce 0; if ($http_user_agent ~* "(spider|bot|crawler|https?://)"){ set $ly_cahce 1; } if ($http_user_agent ~* "(spider|PetalBot|bingbot|Applebot|Googlebot)"){ set $ly_cahce 2; } if ($ly_cahce = 1){ return 403; }
我的這個插件的純靜態規則是已經包含以上規則就不需要重置添加,百萬數據優化純靜態化緩存數據分表分離 http://www.mayasowe.com/zblogphp-plugin/75.html
《nginx規則屏蔽國外的垃圾蜘蛛》.doc
將本文下載保存,方便收藏和打印
導出文檔