Answer the question
In order to leave comments, you need to log in
GeoIP NGINX open access for specific IP addresses?
Good afternoon, tell me how to open access for certain IP addresses from Latvia with this config?
geoip_country /usr/share/GeoIP/GeoIP.dat;
map $geoip_country_code $allowed_country {
default yes;
LV no;
}
В блок server виртуального хоста добавил
if ($allowed_country = no) {
return 403;
}
Answer the question
In order to leave comments, you need to log in
Take out separately:
map $remote_addr $extnet {
default 0;
104.192.143.0/24 1; # bitbucket.org
xx.xx.xx.145 1; # some-client
............................................... ......................
}
Use like this:
set $geoblock 0;
if ($extnet = 1){set $geoblock 0;}
if ($geoblock = 1){return 404;}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question