nigx屏蔽无用爬虫

大量恶意爬虫占用系统资源,频繁访问服务器快耗竭。快速屏蔽掉无用爬虫可以参考下面方法。

3.229.95.193 - - 28/Apr/2025:08:27:58 +0800 "GET /news/1563.html HTTP/1.1" 200 11642 "-" "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Amazonbot/0.1; +https://developer.amazon.com/support/amazonbot) Chrome/119.0.6045.214 Safari/537.36"

通过宝塔面板,伪静态重写,代码如下:

if (http_user_agent \~\* "SemrushBot/7\~bl\|YandexBot\|Amazonbot/0.1\|GPTBot/1.2\|GPTBot\|Bytespider\|meta-externalagent\|Amazonbot\|GPTBot\|Meta-ExternalAgent\|FeedDemon\|Indy Library\|Alexa Toolbar\|AskTbFXTV\|AhrefsBot\|CrawlDaddy\|CoolpadWebkit\|Java\|Feedly\|UniversalFeedParser\|ApacheBench\|Microsoft URL Control\|Swiftbot\|ZmEu\|oBot\|jaunty\|Python-urllib\|lightDeckReports Bot\|YYSpider\|DigExt\|HttpClient\|MJ12bot\|heritrix\|EasouSpider\|Ezooms\|\^" ) {

return 403;

}

重写之后,系统负载正常。

相关推荐
深蓝电商API7 小时前
AI驱动的自适应爬虫框架设计思路全解析
人工智能·爬虫
小白学大数据7 小时前
AI 智能爬虫实战:Selenium+Python 自动绕反爬、一键提取数据
爬虫·python·selenium·数据分析
深蓝电商API10 小时前
用LangChain + Playwright打造智能网页数据助手
爬虫·langchain
belong_my_offer10 小时前
爬虫指南top one
爬虫
夏末蝉未鸣0111 小时前
跨境IT应用(4):用爬虫把产品关键词排名存进数据库,让运营随时回溯
爬虫
深蓝电商API1 天前
大模型 + 爬虫 = ?我用 AI 做了一个自适应反反爬引擎
人工智能·爬虫
༒࿈南林࿈༒1 天前
国家医保局 API 加密体系逆向全记录——SM2签名 + SM4加解密 + SHA256 头签名
爬虫·大模型应用·mcp·skills
跨境数据猎手1 天前
复刻Cssbuy跨境淘宝代购集运系统搭建方案
爬虫·架构·系统架构
郑洁文1 天前
基于网络爬虫的XSS漏洞检测系统的设计与实现
网络·爬虫·网络安全·xss
Super Scraper1 天前
如何将赋予千问(Qwen Code)网络检索功能:集成MCP服务器
人工智能·爬虫·ai·自动化·千问·mcp·qwen code