V
V
Vladimir Revyakin2017-04-12 10:36:47
Nginx
Vladimir Revyakin, 2017-04-12 10:36:47

GeoIP NGINX not working?

Good evening, tell me what I'm doing wrong in the http block in the config file nginx.conf added

geoip_country /usr/share/GeoIP/GeoIP.dat;
  map $geoip_country_code $allowed_country {
  default yes;
  LV no;
}

Added to the server block of the virtual host
if ($allowed_country = no) {
            return 403;
        }

I figured it out with these, everything works, the task is to open access for certain Latvian IPs so that they only let them in, but not the rest of Latvia, does anyone have any ideas?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question