Answer the question
In order to leave comments, you need to log in
Nginx, how to block countries but not crawlers?
Good day!
Please tell me the correct nginx config for blocking countries and at the same time for skipping search robots (by user-agent). Needed to fight DDoS.
Blocking by country, as far as I understand, will be like this:
geoip_country /usr/share/GeoIP/GeoIP.dat;
map $geoip_country_code $bad_country {
default 1;
include geo/good_countries;
}
location / {
if ($bad_country){
return 403;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question