- A+
所属分类:Nginx
有些时候,需要阻止某些用户代理访问网站,比如ab,wget,curl等等,这就需要使用到$http_user_agent变量。
修改nginx.conf
1 2 3 4 5 6 7 |
if ($http_user_agent ~* (Wget|ab) ) { return 403; } if ($http_user_agent ~* LWP::Simple|BBBike|wget) { return 403; } |
重启nginx
1 |
# /usr/local/nginx-1.7.0/sbin/nginx -s reload |

微信公众号
扫一扫关注运维生存时间公众号,获取最新技术文章~
02/04/2015 下午 5:26 沙发
$http_user_agent还有哪些未收录的变量么?