I have nginx-1.12.1 installed on Centos 6.7 final. Already loaded the --with-http_geoip_module on configure arguments.
I have this code on my nginx.conf inside http context
geoip_city /usr/local/share/GeoIP/GeoLiteCity.dat;
Also add this code
map $geoip_city $not_allowed_region {
default no;
Shanghai yes;
}
Inside my vhost conf file
# server content
if ($not_allowed_region = yes) {
rewrite ^/(.*)$ https://test.com redirect;
}
I did nginx -t and also restart using nginx -s reload but nothing happens.