Closed SeePrashanth closed 3 years ago
Move the following two includes in your server(vhost) conf files to the top.
include /etc/nginx/bots.d/ddos.conf; include /etc/nginx/bots.d/blockbots.conf;
like this:
server { listen 80 default_server; listen [::]:80 default_server;
include /etc/nginx/bots.d/ddos.conf;
include /etc/nginx/bots.d/blockbots.conf;
# rest of config below
}
@true2thepen thank you it is working fine.
@true2thepen thank you it is working fine.
Please how did you get it to work?
@mitchellkrogza
[ ]
[ ]
[ ] # --------------
BLOCK BAD BOTS
--------------
Section bot_1 Unused
limit_conn bot1_connlimit 100;
limit_req zone=bot1_reqlimitip burst=50;
limit_conn bot2_connlimit 10; limit_req zone=bot2_reqlimitip burst=10; if ($bad_bot = '3') { return 444; # << Response Code Issued May Be Modified to Whatever you Choose ie. 404 but 444 wastes less of Nginxs time }
@mitchellkrogza above entry from /etc/nginx/bots.d/blockbots.conf file and the line number 58 is "if ($bad_bot = '3') {"
Upto step5 everything is fine as per below link followed
https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/blob/master/AUTO-CONFIGURATION.md
from step 6 is below error happened
when i do nginx -t i got below
"nginx: [emerg] "if" directive is not allowed here in /etc/nginx/bots.d/blockbots.conf:58" i'm using "default" vhost file and file name is only default.
my os version is ubuntu 20.04 and my nginx version: nginx/1.18.0 (Ubuntu)
Kindly confirm how to resolve the issue.