GeoIP Question

petrosetta nginx-forum at forum.nginx.org
Tue Jan 8 21:32:10 UTC 2019


Hi All 
I would really appreciate some help here. I want to restrict all countries
except the US and Jamaica (JM).

load_module "/usr/local/libexec/nginx/ngx_http_geoip_module.so";

These are my entries in nginx.conf

Under http
    map $geoip_country_code $country_access {
        "US" 0;
        "JM" 0;
        default 1;
    }

Under HTTP Server
     if ($country_access = '1') {
     return 403;
     }

Under HTTPS Server
 server {
        if ($country_access = '1') {
        return 403;
        }

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,282589,282589#msg-282589



More information about the nginx mailing list