Nginx防蜘蛛爬虫处理
假定一个场景:某个网站它可能不希望被网络爬虫抓取,例如测试环境不希望被抓取,以免对用户造成误导,那么需要在该网站中申明,本站不希望被抓取。有如下方法:
方法一:修改nginx.conf,禁止网络爬虫的ua,返回403。
server {
listen 80;
server_name 127.0.0.1;
#添加如下内容即可防止爬虫
if ($http_user_agent ~* "qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot")
{
return 403;
}
方法2:网站更目录下增加Robots.txt,放在站点根目录下。
在http://tool.chinaz.com/robots/站点可以针对现在的搜索引擎按照想要的规则生成robots.txt文件。
知识扩展:
robots.txt是搜索引擎中访问网站的时候要查看的第一个文件。robots.txt文件告诉蜘蛛程序在服务器上什么文件是可以被查看的。
Nginx防蜘蛛爬虫处理的更多相关文章
- 使用 Nginx 过滤网络爬虫
现在有许多初学者学习网络爬虫,但他们不懂得控制速度,导致服务器资源浪费.通过 Nginx 的简单配置,能过滤一小部分这类爬虫. 方法一:通过 User-Agent 过滤 Nginx 参考配置如下: l ...
- Nginx防爬虫或限制浏览器访问
假定一个场景:某个网站它可能不希望被网络爬虫抓取,例如测试环境不希望被抓取,以免对用户造成误导,那么需要在该网站中申明,本站不希望被抓取.有如下方法: 方法一:修改nginx.conf,禁止网络爬虫的 ...
- nginx防DDOS、cc、爬虫攻击
一.防止DDOS.CC攻击 http { limit_conn_zone $binary_remote_addr zone=perip:10m; limit_conn_zone $server_nam ...
- nginx——Nginx 防爬虫优化
if ($http_user_agent ~* "qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediap ...
- Nginx 防爬虫设置
在conf下 vi 一个文件agent_deny.conf 添加如下内容 #禁止Scrapy|curl等工具的抓取 if ($http_user_agent ~* (Scrapy|Curl|Http ...
- nginx限制蜘蛛的频繁抓取
蜘蛛抓取量骤增,导致服务器负载很高.最终用nginx的ngx_http_limit_req_module模块限制了百度蜘蛛的抓取频率.每分钟允许百度蜘蛛抓取200次,多余的抓取请求返回503. ngi ...
- 转:nginx防DDOS攻击的简单配置
文章来自于: 近期由于工作需要,做了些防DDOS攻击的研究,发现nginx本身就有这方面的模块ngx_http_limit_req_module和ngx_http_limit_conn_module. ...
- 使用Nginx过滤网络爬虫
原文:https://www.liaoxuefeng.com/article/001509844125769eafbb65df0a04430a2d010a24a945bfa000 现在的网络爬虫越来越 ...
- nginx防ddos配置
Nginx limit_zone与limit_req_zone (防DDOS攻击模块) http { limit_req_zone $binary_remote_addr zone=one:100m ...
随机推荐
- linux i2c 设备节点读写
最近需要操作24C02,封装了一下函数方便以后操作. 参考链接: https://my.oschina.net/handawei/blog/68526 http://blog.csdn.net/one ...
- Javascript对象、Jquery扩展简单应用
Javascript对象,表现方式一: person = new Object(); person.firstname = "An"; person.lastname = &quo ...
- http://www.cnblogs.com/peida/archive/2013/04/23/3036035.html
http://www.cnblogs.com/peida/archive/2013/04/23/3036035.html
- rem适配
//REM适配new function() { var _self = this; _self.width = 640; // 设置默认最大宽度 _self.fontSize = 100; // 默认 ...
- jQuery选择器总结(转)
? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 ...
- Speed-BI 多事实表与表间计算的应用:销售目标达成分析 另一种实现方法
在前一篇<Speed-BI多事实表与表间计算的应用(excel多Sheet关联分析):销售目标达成分析>http://www.powerbibbs.com/forum. ... 7583& ...
- markdown语法集锦
参考:http://wowubuntu.com/markdown/#blockquote 1. 标题 # 一级标题 ## 二级标题 ### 三级标题 共六级标题 2. 列表 有序列表:1,2,3: 无 ...
- 有用C函数集锦
1. offsetof #include <stddef.h> size_t offsetof(type, member); The macro offsetof() returns th ...
- 设计视图不能用于 x64 和 ARM 目标平台
设计视图不能用于 x64 和 ARM 目标平台
- News: Visual Studio Code support debugging Linux Apps
http://arstechnica.com/information-technology/2015/11/visual-studio-now-supports-debugging-linux-app ...