nginx-mod-http-geoip
nginx-mod-http-geoip
is an nginx module that allows you to determine the geographical location of an IP address. The geo of country is presented by Alpha-2 code.
You can find ISO ISOβs full, searchable list of all country codes to find your code.
map $geoip_country_code $allowed_country {
default no;
RU yes; # <ISO 3166-1 alpha-2> <yes/no>
}
server {
...
if ($allowed_country = no) {
return 403;
}
...
}
Enjoy you practice π
Top comments (0)