Nginx – How to rate-limit requests sent by bots for a Nginx server

nginxrate-limitingUbuntu

There are many bots out there. Majestic bot is one of them. It sometimes crawls the website's pages by force, i.e. the server sometimes sends 100 requests during 1 second. Majestic bot is just an example. I don't want to block a certain bot, there are many bots and trying to detect them is waste of time.

My question is: How can I rate-limit HTTP requests that are sent by a certain bot to a Nginx server? As an example just 10 requests during 1 second is allowed for an IP address. And does this operation consume noticeable resources (As the IP address should be checked and stored in somewhere)?

Best Answer

Any attempt at elaboration on my part beyond referring to the following is pointless:

http://nginx.org/en/docs/http/ngx_http_limit_req_module.html