寶塔皮膚遮蔽垃圾搜尋引擎蜘蛛和掃描工具的辦法

126雲發表於2021-05-04

目前除了我們常見的搜尋引擎如百度、Google、Sogou、360等搜尋引擎之外,還存在其他非常多的搜尋引擎,通常這些搜尋引擎不僅不會帶來流量,因為大量的抓取請求,還會造成主機的CPU和頻寬資源浪費,遮蔽方法也很簡單,按照下面步驟操作即可,原理就是分析指定UA然後遮蔽。

首先進入寶塔皮膚,檔案管理進入/www/server/nginx/conf目錄,新建空白檔案kill_bot.conf。然後將以下程式碼儲存到當前檔案中。


#禁止垃圾搜尋引擎蜘蛛抓取

if ($http_user_agent ~* "CheckMarkNetwork|Synapse|Nimbostratus-Bot|Dark|scraper|LMAO|Hakai|Gemini|Wappalyzer|masscan|crawler4j|Mappy|Center|eright|aiohttp|MauiBot|Crawler|researchscan|Dispatch|AlphaBot|Census|ips-agent|NetcraftSurveyAgent|ToutiaoSpider|EasyHttp|Iframely|sysscan|fasthttp|muhstik|DeuSu|mstshash|HTTP_Request|ExtLinksBot|package|SafeDNSBot|CPython|SiteExplorer|SSH|MegaIndex|BUbiNG|CCBot|NetTrack|Digincore|aiHitBot|SurdotlyBot|null|SemrushBot|Test|Copied|ltx71|Nmap|DotBot|AdsBot|InetURL|Pcore-HTTP|PocketParser|Wotbox|newspaper|DnyzBot|redback|PiplBot|SMTBot|WinHTTP|Auto Spider 1.0|GrabNet|TurnitinBot|Go-Ahead-Got-It|Download Demon|Go!Zilla|GetWeb!|GetRight|libwww-perl|Cliqzbot|MailChimp|SMTBot|Dataprovider|XoviBot|linkdexbot|SeznamBot|Qwantify|spbot|evc-batch|zgrab|Go-http-client|FeedDemon|JikeSpider|Indy Library|Alexa Toolbar|AskTbFXTV|AhrefsBot|CrawlDaddy|CoolpadWebkit|Java|UniversalFeedParser|ApacheBench|Microsoft URL Control|Swiftbot|ZmEu|jaunty|Python-urllib|lightDeckReports Bot|YYSpider|DigExt|YisouSpider|HttpClient|MJ12bot|EasouSpider|LinkpadBot|Ezooms") {
 return 403;
 break;
}

#禁止掃描工具客戶端
if ($http_user_agent ~* "crawl|curb|git|Wtrace|Scrapy" ) {
 return 403;
 break;
}


儲存後返回到寶塔 - 【網站】-【設定】點選左側 【配置檔案】選項卡,在     #SSL-START SSL相關配置,請勿刪除或修改下一行帶註釋的404規則 上方空白行插入程式碼: include kill_bot.conf;   儲存後即可生效,這樣這些蜘蛛或工具掃描網站的時候就會提示403禁止訪問。



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69957453/viewspace-2770807/,如需轉載,請註明出處,否則將追究法律責任。

相關文章