昨天我只是把他的IP给屏蔽了,然后他今天又来了,并且换了个IP
那索性给他来个全套套餐好了,直接把大部分垃圾蜘蛛给屏蔽掉
首先进入宝塔面板,文件管理进入 /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禁止访问。
停留在世界边缘,与之惜别