Answer the question
In order to leave comments, you need to log in
The conditions in the config do not work, I can not understand why
There is a flood on the server. There are such lines in the logs, only the IP addresses are different
88.81.228.6 — - [06/Sep/2012:12:53:37 +0400] "GET / HTTP/1.0" 200 36271 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)" "-" | "-"
I want to filter this case with nginx
server {
.....
set $add 1;
set $ban '';
###### Rule 1 ########
if ($http_referer = '-' ) {
set $ban $ban$add;
}
if ($request_uri = '/') {
set $ban $ban$add;
}
if ($http_user_agent = 'Mozilla\/5\.0 \(Windows\; U\; Windows NT 6\.1\; en\-US\)') {
set $ban $ban$add;
}
if ($ban = 111) {
return 444;
}
######################
......
}
Answer the question
In order to leave comments, you need to log in
Maybe because $ban is 11?
if ($http_user_agent = 'Mozilla\/5\.0 \(Windows\; U\; Windows NT 6\.1\; en\-US\)') {
set $ban $ban$add;
}
A bit off topic, but you can use the nginx.org/ru/docs/http/ngx_http_limit_req_module.html module
The simplest option is to add the debug_connection BOT_IP directive; in the events context and see the debug log.
Does anyone else have any idea why the conditions don't work? tried everything I think
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question