P
P
PendalF892019-08-22 11:32:17
Nginx
PendalF89, 2019-08-22 11:32:17

How to automatically block users by IP in Nginx?

How do I configure nginx, or put something in front of it, to block IP addresses that have more than a certain number of visits to the site?
For almost a week someone has been shitting on one of my sites. Moreover, if it were just parsing, I wouldn’t bother, but here they come from the browser (I assume that they use selenium or phantom), wait 1-2 seconds, or don’t wait at all and close the page. The metric sees this and fixes it, and accordingly, behavioral factors worsen. In Metrica, this is reflected as a surge in direct visits to the site.
Now I put https://goaccess.io/,cool thing for analyzing logs, with the help of this tool I do this: I see an abnormal number of requests from some ip and block it in Nginx. Here, we need a tool that would do this automatically. I'm sure there is one.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question