Apache与Nginx环境屏蔽YisouSpider爬虫的方法
早上一个朋友告知其没有流量的博客突然出现访问很慢,然后打不开提示信息主机资源超量等信息(具体的提示我也忘记复制下来),大概意思就是占用资源过大短期被屏蔽。因为是虚拟主机,采用的是APACHE架构服务,所以比较简单,直接帮他登录CPANEL面板取得日志文件,然后查看后吓一跳。原来是来自YisouSpider蜘蛛的爬行导致占用内存和CPU过大导致的资源消耗,一个小小的博客没有流量的怎么可能会这样呢,我看他的博客只有几篇文章而已。解决方法很简单,我们直接在.htaccess文件中屏蔽这个IP就可以。Order Allow,Deny
Allow from all
Deny from 42.120.161.43在.htaccess文件中增加上面三行,如果有多个IP地址的话,用空格隔开。搜索了一下,发现出现这样问题的还真不少,而且还看到有人专门整理了所有的YisouSpider蜘蛛IP地址,我们可以全部屏蔽未雨绸缪,也可以等有问题的时候一个个添加。网友整理的所有YiSouSpider IP地址:Deny from 42.156.136.95
Deny from 42.156.137.67
Deny from 42.156.137.62
Deny from 42.156.137.63
Deny from 42.156.137.60
Deny from 42.156.138.113
Deny from 42.120.161.37
Deny from 42.120.161.32
Deny from 42.120.161.65
Deny from 42.156.139.95
Deny from 42.156.136.113
Deny from 42.156.136.44
Deny from 42.156.136.42
Deny from 42.156.136.40
Deny from 42.156.139.51
Deny from 42.156.139.53
Deny from 42.156.139.55
Deny from 42.156.139.54
Deny from 42.156.139.57
Deny from 42.156.138.63
Deny from 42.156.138.62
Deny from 42.156.138.61
Deny from 42.156.138.60
Deny from 42.156.138.67
Deny from 42.120.161.62
Deny from 42.156.138.65
Deny from 42.120.160.67
Deny from 42.120.161.95
Deny from 42.120.160.113
Deny from 42.120.160.63
Deny from 42.120.160.62
Deny from 42.120.160.61
Deny from 42.120.160.60
Deny from 42.156.138.81
Deny from 42.156.138.80
Deny from 42.156.138.83
Deny from 42.156.138.82
Deny from 42.156.136.23
Deny from 42.156.137.53
Deny from 42.156.137.51
Deny from 42.156.137.57
Deny from 42.156.138.104
Deny from 42.156.139.5
Deny from 42.156.139.4
Deny from 42.120.161.23
Deny from 42.120.161.24
Deny from 42.156.136.107
Deny from 42.156.137.61
Deny from 42.156.136.50
Deny from 42.156.136.51
Deny from 42.156.136.53
Deny from 42.156.136.54
Deny from 42.156.136.55
Deny from 42.156.136.57
Deny from 42.156.139.42
Deny from 42.156.138.75
Deny from 42.156.139.40
Deny from 42.156.138.77
Deny from 42.156.138.74
Deny from 42.120.160.74
Deny from 42.120.160.75
Deny from 42.120.160.109
Deny from 42.120.160.77
Deny from 42.156.137.40
Deny from 42.156.138.95
Deny from 42.120.160.16
Deny from 42.120.160.17
Deny from 42.120.160.15
Deny from 42.120.160.13
Deny from 42.120.160.10
Deny from 42.120.160.28
Deny from 42.156.139.77
Deny from 42.120.161.57
Deny from 42.156.139.74
Deny from 42.120.161.51
Deny from 42.120.161.53
Deny from 42.120.161.18
Deny from 42.156.136.83
Deny from 42.156.136.27
Deny from 42.120.160.81
Deny from 42.120.160.80
Deny from 42.120.160.83
Deny from 42.120.160.82
Deny from 42.156.136.28
Deny from 42.120.161.63
Deny from 42.156.137.32
Deny from 42.156.137.37
Deny from 42.120.160.23
Deny from 42.156.136.82
Deny from 42.156.136.81
Deny from 42.156.136.80
Deny from 42.120.160.24
Deny from 42.156.136.4
Deny from 42.156.136.5
Deny from 42.156.136.2
Deny from 42.120.160.9
Deny from 42.120.160.4
Deny from 42.120.160.5
Deny from 42.120.160.2
Deny from 42.156.139.60
Deny from 42.156.139.61
Deny from 42.156.139.62
Deny from 42.156.139.63
Deny from 42.120.161.42
Deny from 42.120.161.40
Deny from 42.156.139.67
Deny from 42.156.138.20
Deny from 42.156.138.16
Deny from 42.156.138.17
Deny from 42.156.138.15
Deny from 42.156.136.37
Deny from 42.120.160.95
Deny from 42.156.136.32
Deny from 42.156.136.31
Deny from 42.156.136.24
Deny from 42.156.137.23
Deny from 42.156.137.20
Deny from 42.120.160.37
Deny from 42.120.160.32
Deny from 42.156.137.28
Deny from 42.156.139.82
Deny from 42.156.139.83
Deny from 42.156.139.80
Deny from 42.156.139.81
Deny from 42.120.161.4
Deny from 42.156.138.107
Deny from 42.156.138.24
Deny from 42.156.138.23
Deny from 42.120.161.74
Deny from 42.120.160.19
Deny from 42.156.138.28
Deny from 42.156.139.15
Deny from 42.156.139.17
Deny from 42.156.139.19
Deny from 42.156.139.18
Deny from 42.120.160.40
Deny from 42.120.160.42
Deny from 42.120.161.20
Deny from 42.156.138.19
Deny from 42.120.161.68
Deny from 42.156.137.2
Deny from 42.120.161.66
Deny from 42.120.161.67
Deny from 42.120.161.60
Deny from 42.120.161.61
Deny from 42.156.137.5
Deny from 42.156.137.4
Deny from 42.156.138.32
Deny from 42.156.138.68
Deny from 42.156.136.18
Deny from 42.156.136.19
Deny from 42.156.138.37
Deny from 42.156.136.15
Deny from 42.156.136.16
Deny from 42.156.136.17
Deny from 42.156.136.13
Deny from 42.156.139.28
Deny from 42.120.160.53
Deny from 42.120.160.50
Deny from 42.120.160.51
Deny from 42.120.161.5
Deny from 42.120.160.57
Deny from 42.120.160.55
Deny from 42.120.161.9
Deny from 42.120.161.19
Deny from 42.156.139.107
Deny from 42.156.139.22
Deny from 42.120.161.15
Deny from 42.120.161.17
Deny from 42.156.137.24
Deny from 42.120.161.83
Deny from 42.156.136.61
Deny from 42.156.136.60
Deny from 42.156.136.63
Deny from 42.156.136.62
Deny from 42.156.136.67
Deny from 42.156.137.107
Deny from 42.156.139.32
Deny from 42.156.139.31
Deny from 42.120.161.81
Deny from 42.156.139.37
Deny from 42.156.138.40
Deny from 42.156.137.19
Deny from 42.156.138.42
Deny from 42.156.137.17
Deny from 42.156.137.15
Deny from 42.156.137.13
Deny from 42.156.137.10
Deny from 42.120.161.55
Deny from 42.120.161.113
Deny from 42.120.161.77
Deny from 42.156.137.74
Deny from 42.156.137.77
Deny from 42.156.137.95
Deny from 42.156.138.2
Deny from 42.156.138.4
Deny from 42.156.138.5
Deny from 42.156.139.113
Deny from 42.120.160.20
Deny from 42.156.137.80
Deny from 42.156.137.81
Deny from 42.156.137.82
Deny from 42.156.137.83
Deny from 42.156.137.113
Deny from 42.156.139.71
Deny from 42.156.139.24
Deny from 42.156.139.20
Deny from 42.156.136.77
Deny from 42.156.136.74
Deny from 42.156.139.23
Deny from 42.120.161.82
Deny from 42.156.138.57
Deny from 42.120.161.80
Deny from 42.156.138.55
Deny from 42.156.138.53
Deny from 42.156.138.50
Deny from 42.156.138.51PS:如果我们是NGINX环境系统,我们也可以到自己当前网站的.CONF文件中添加deny 42.120.161.43;这样我们一样可以屏蔽当前这个IP地址的访问。PS:这里在补充Nginx环境屏蔽YisouSpider爬虫的方法,我们可以直接将整个爬虫User Agent端口屏蔽,反正也没有多大的用途。if ($http_user_agent ~* "YisouSpider") {
return 403;
}在我们当前站点的.conf文件中添加上面的脚本,保存替换之后重启Nginx生效,这样我们就可以让所有的YisouSpider返回403。
页:
[1]