用了多种方法,暂时把恶意蜘蛛屏蔽了,给大家分享一下经验!
前几天做的淘客站,毕竟是用的38元一年的华为云服务器,感觉不是那么抗造!几天时间各种垃圾蜘蛛都来了,又不想花钱买防火墙。。
总结一下经验:
1,使用robots协议:通过在网站根目录下放置一个名为robots.txt的文件,明确告知搜索引擎爬虫哪些页面是可以被抓取的,哪些是不希望被抓取的。虽然robots协议并非强制执行的标准,但它对于善意爬虫具有道德约束力User-agent: AmazonbotDisallow: /User-agent: facebookexternalhitDisallow: /User-agent: FacebotDisallow: /User-agent: TelegramBotDisallow: /User-agent: DataForSeoBotDisallow: /User-agent: YandexBotDisallow: /User-agent: PetalBotDisallow: /User-agent: DotBotDisallow: /User-agent: AhrefsBotDisallow: /User-agent: MJ12botDisallow: /User-agent: BytespiderDisallow: /User-agent: SemrushBotDisallow: /User-agent: SlurpDisallow: /User-agent: twicelerDisallow: /User-agent: ScrubbyDisallow: /User-agent: RobozillaDisallow: /User-agent: GPTBotDisallow: /User-agent: facebookDisallow: /User-agent: open_aiDisallow: /
2,限制User-Agent字段:通过识别User-Agent字段,可以区分正常用户和爬虫程序。对于非浏览器客户端发起的请求,特别是那些常见的爬虫User-Agent,可以直接拒绝服务。然而,高级爬虫可能通过修改User-Agent字段来伪装成正常用户,因此这种方法并不能完全阻止恶意爬虫 if ($http_user_agent ~* "TelegramBot|DataForSeoBot|YandexBot|PetalBot|DotBot|facebookexternalhit|AhrefsBot|MJ12bot|Bytespider|SemrushBot|Slurp|twiceler|Scrubby|Robozilla|GPTBot|facebook|Amazonbot|Amazonbot|facebookexternalhit|Facebot") { return 403;
3,限制IP地址:通过监控和分析访问日志,识别出频繁发起请求的IP地址,并将其加入黑名单。这种方法对于来自单一IP地址或IP段的恶意爬虫非常有效,但对于拥有大量代理IP或IP池的恶意爬虫效果不佳
3,添加访问验证码
4.宝塔界面安全组,访问限制,境外ip全部限制。
5.域名解析在域名解析里面,A解析,境外解析到其他Ip,比如:1.1.1.1把这些全部都整上,现在好一点了。
最后,感觉华为云2H2G2M带宽 好像有点不够。确实带不动!
感觉分享 Bytespider这个不是头条的吗? 支持一下 不懂不懂 有点高深哟 看这个
https://www.52txr.cn/2025/banaicurl.html
屏蔽恶意蜘蛛ai 宝塔免费版可以操作 感谢分享 头条只抓不收,就恼火 我也很多恶意的
页:
[1]
2