Limit robots

double nginx-forum at nginx.us
Fri Jan 13 13:36:20 UTC 2012


Hello,

Is there a chance to limit robots to 1 request per second?
The down below does not work:  [emerg] "limit_req" directive is not
allowed here

Thanks a lot
Markus


http {
    limit_req_zone      $http_user_agent  zone=useragenttrack:1m 
rate=1r/s;
    server {
        listen          80;
        location / {
            if ($http_user_agent ~* "[a-z]bot[^a-z]") {
                limit_req   zone=useragenttrack  burst=100 nodelay;
            }
        }
    }
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,221162,221162#msg-221162



More information about the nginx mailing list