DT27
2021-08-10 19:09:18 +08:00
分享个我自己的垃圾屏蔽规则
#禁垃圾蜘蛛
if ($http_user_agent ~* "YandexBot|DotBot|SeznamBot|SemrushBot|YisouSpider|serpstatbot|Bytespider|TinEye-bot|WordPress|Datanyze|woorankreview|CCBot|BPImageWalker|SabsimBot|MJ12bot|SEOkicks|SlurpChina|1subscribers|DomainStatsBot|Qwantify|AhrefsBot") {
return 400;
break;
}
#禁部分爬取工具
if ($http_user_agent ~* "crawl|curb|git|Wtrace|Scrapy|python-requests|Go-http-client|python-requests" ) {
return 400;
break;
}
#禁特殊后缀
location ~* \.(asp|aspx|ashx|htaccess|ini|env|git|project|cgi|java|action|jsp|cfg|tpl|sql)$ {
return 400;
break;
}