Welcome! Log In Create A New Profile

Advanced

Re: Limit robots

António P. P. Almeida
January 13, 2012 08:52AM
On 13 Jan 2012 13h36 WET, nginx-forum@nginx.us wrote:

> 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

Yes. Try:

At the *http* level:

limit_req_zone $http_user_agent zone=useragenttrack:1m rate=1r/s;

map $http_user_agent $is_bot {
default 0;
~[a-z]bot[^a-z] 1;
}

At the server level:

location / {
error_page 418 @bots;

if ($is_bot) {
return 418;
}
...
}

location @bots {
limit_req zone=useragenttrack burst=100 nodelay;
...
}

Cf: http://wiki.nginx.org/HttpLimitReqModule

--- appa

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Limit robots

double January 13, 2012 05:57AM

Re: Limit robots

António P. P. Almeida January 13, 2012 08:52AM

Re: Limit robots

Jeff J. January 17, 2012 12:18PM

Re: Limit robots

António P. P. Almeida January 17, 2012 02:28PM

Re: Limit robots

Jeff J. January 17, 2012 03:08PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 305
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready