nginx 访问控制
nginx 访问控制
- 可以匹配正则
location ~ .*(abc|image)/.*\.php$
{
deny all;
}
- 根据user_agent限制
if ($http_user_agent ~ 'Spider/3.0|YoudaoBot|Tomato')
{
return 403;
}
deny all和return 403效果一样
- 测试使用curl -A Tomato 或者 curl --user-agent Tomato 进行模拟代理