网上有很多爬虫,有些是有利于百度收录的,比如百度爬虫,有些是没用的爬虫,比如YisouSpider,不仅不遵循robots标准,对网络服务器造成工作压力,而且无法为网站产生总流量。
下面详细介绍如何禁止这个没用的用户代理浏览网址。
转到nginx安装文件下的conf文件目录,将以下代码保存为agent_deny.conf
cd/usr/local/nginx/conf
vimagent_deny.conf
#Scrapy等专用工具禁止抓取if($http_user_agent~*(Scrapy|curl|httpclient)){return403;}#禁止浏览if($http_user_agent~"feeddemon|jikespider|Indylibrary|Alexatoolbar|asktbfxtv|ahrefsbot|crawldaddy|coolpadWebKit|Java|)带有特定UA和uaas空feedly|universalfee[湖北SEO]DParser|ApacheBench|微软URLcontrol|swiftbot|zmeu|obot|jaunty|python-urllib|lightdeckreportsbot|YYspider|digext|yisouspider|httpclient|mj12bot|heritrix|easouspider|ezooms|^$”){return400}#严禁抢if($request_method!~^(GET|HEAD|POST)$){返回403;}
然后,在URL的相关设备中的位置/{后插入以下代码:
包含agent_deny.conf
【湖北SEO】存储后执行以下指令,顺利重启nginx:
/usr/local/nginx/sbin/nginx-s重新加载
模拟搜索引擎蜘蛛的抓取;
curl-I-A'YisouSpider'http://网址链接
结果返回到403。
用UAas空模拟抓取:
curl-I-A"http://网站链接
结果返回到403。
模拟百度爬虫的抓取;
Cur-I-A“百度蜘蛛”http://网站链接
结果回到了200。
下面是网上一般的废物UA目录。
FeedDemon内容集合
BOT/0.1(JCE版BOT)SQL注入
CrawlDaddysql注入
Java内容集合
Jullo内容集合
Feedly内容收集
UniversalFeedParser内容集合
ApacheBenchcc攻击者
Swiftbot无用爬虫
YandexBot无用爬虫
无用的爬虫
无用的爬虫
无用的爬虫
MJ12bot无用爬虫
Euphpmyadmin漏洞检测
WinHttp收购cc攻击
无用的爬虫
HttpClienttcp攻击
MicrosoftURL控制扫描程序
YYSpider无用爬虫
工程爆破扫描仪
无用的爬虫
Python-urllib内容集合
印第图书馆扫描仪
无用的爬虫
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)