Sunday 15 January 2012

How to grant access to a specific IP address that is blocked by GeoIP[country] in nGinx? -


This solution can not be solved as to how I block the country's access and block me at the same time Great access to specific IPs from the country is required.

1) Add to nginx.conf

  http {geoip_country / usr / share / GeoIP / GeoIP.dat; $ Geoip_country_code $ permission_mount map {not default; L.V. Yes; # In my case this is Latvia (allowed country, but not all others)} Geo $ exclusions {default 0; 123.123.123.123 1; # Here is the IP which is in the blocked country list}}   

2) Allows your vhost configuration server in {} container

  if ($ permission is calculated = Yes) {Set $ ​​exclusions 1; } If ($ exclusion = "0") {return 403; }   

is the main idea

No comments:

Post a Comment