A
A
Andrey2021-04-13 09:14:03
linux
Andrey, 2021-04-13 09:14:03

How to limit the number of requests to the site from one IP per hour?

The essence of the problem: the site is parsed through a proxy network (about 200 IP). It is necessary to limit such requests, while not blocking search engine robots.

Now requests are limited by Nginx via limit_req_zone + fail2ban. But all this does not work well, because it turns out to be limited to several requests per second . I want to set up an hour limit, let's say only 1800 requests per hour are allowed per IP . How to do it?

p.s. Ubuntu OS.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Dmitriev, 2021-04-13
@SignFinder

In nginx-mod https://www.getpagespeed.com/nginx-mod-a-better-fa... there is:

spoiler
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/h; # 1 request per hour
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/d; # 1 request per day
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/w; # 1 request per week
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/M; # 1 request per month
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/Y; # 1 request per year

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question