Nginx禁止指定user_agent
2017-06-14 17:52
323 查看
Nginx禁止指定user_agent
[root@LHQ ~]# cd /usr/local/nginx/conf/vhosts
[root@LHQ vhosts]# vim test.conf
使用 user_agent 控制客户端访问
location /
{
if ($http_user_agent ~* 'bingbot/2.0|MJ12bot/v1.4.2|Spider/3.0|YoudaoBot|Tomato|Gecko/20100315')(匹配波浪号后面的字符,直接显示403;~*:组合一起使用,意思是不区分大小写)
{
return 403;
}
}
使用curl测试:
[root@LHQ vhosts]# curl -A "wsefdfewfefe.ferwfe" -x192.168.1.254:80 www.test.com/forum.php -I
没用的蜘蛛都删除,有用的才保留
[root@LHQ ~]# cd /usr/local/nginx/conf/vhosts
[root@LHQ vhosts]# vim test.conf
使用 user_agent 控制客户端访问
location /
{
if ($http_user_agent ~* 'bingbot/2.0|MJ12bot/v1.4.2|Spider/3.0|YoudaoBot|Tomato|Gecko/20100315')(匹配波浪号后面的字符,直接显示403;~*:组合一起使用,意思是不区分大小写)
{
return 403;
}
}
使用curl测试:
[root@LHQ vhosts]# curl -A "wsefdfewfefe.ferwfe" -x192.168.1.254:80 www.test.com/forum.php -I
没用的蜘蛛都删除,有用的才保留
相关文章推荐
- LNMP - nginx禁止指定user_agent
- Nginx配置——禁止指定user_agent
- nginx禁止指定user_agent
- LNMP搭建13:Nginx禁止指定user_agent
- Nginx禁止指定user_agent
- LNMP--Nginx禁止指定user_agent
- LNMP - Nginx禁止指定user_agent
- nginx禁止指定user_agent
- 2.4-nginx禁止指定user_agent
- nginx禁止指定user_agent
- Apache禁止指定的user_agent、指定目录被访问
- apache‘禁止指定user_agent’ 和 ‘禁止用户通过浏览器访问某个目录’
- apache学习笔记(访问控制|禁止解析|禁止指定user_agent)
- Nginx 访问控制&屏蔽指定 user_agent
- 利用nginx来屏蔽指定的user_agent的访问
- Apache 禁止指定user_agent---模块
- nginx防盗链+访问控制+限制指定目录运行php+解析支持php+现在user_agent
- nginx通过user-agent判断蜘蛛,跳转到指定后端服务器…
- Apache禁止解析PHP、禁止指定user_agent、php配置文件
- 2.6 Apache禁止指定user_agent