Answer the question
In order to leave comments, you need to log in
NGINX+GeoIP2. How to allow access to the site from the local network?
Good afternoon!
The config contains the following block for GeoIP:
geoip2 /usr/local/share/GeoIP/GeoLite2-Country.mmdb {
auto_reload 5m;
$geoip2_data_country_code country iso_code;
}
map $geoip2_data_country_code $country_code_allowed {
default deny;
UA allow;
RU allow;
DE allow;
}
if ($country_code_allowed = deny) {
return 444;
}
map $remote_addr $localnets {
default 0;
10.9.6.0/23 1;
10.10.40.0/24 1;
}
if ($localnets = 0) {
return 444;
}
Answer the question
In order to leave comments, you need to log in
Here are two examples (didn't test it myself):
https://stackoverflow.com/questions/17223360/how-t...
https://serverfault.com/questions/585204/nginx-geo...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question