GeoIP On Nginx

Hi guys,

Iam trying to set up geoip functionality on nginx, I believe it works
only with Nginx 0.8 not earlier.

I was using GeoIP with Apache to allow access to Only US IPs with the
following config…

SetEnvIf GEOIP_COUNTRY_CODE US AllowCountry

Deny from all
Allow from env=AllowCountry

How can i achieve the same on Nginx.

Thank You

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

thank you, Igor

is there a way that i can actually drop the connection for the other
Ips, 403 means somebody has a connection to Nginx, i just do not want
that, just want it dropped.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,24927,24938#msg-24938

On Mon, Nov 23, 2009 at 03:19:08AM -0500, himesh wrote:

Hi guys,

Iam trying to set up geoip functionality on nginx, I believe it works only with Nginx 0.8 not earlier.

geoip module is in 0.7 since 0.7.63.
Also, there is another geo module in all modern versions.

How can i achieve the same on Nginx.
server {

if ($geoip_country_code != US) {
return 403;
}

Also, you may see this thread:
http://nginx.org/pipermail/nginx/2009-August/014705.html


Igor S.
http://sysoev.ru/en/

On Mon, Nov 23, 2009 at 05:16:27AM -0500, himesh wrote:

thank you, Igor

is there a way that i can actually drop the connection for the other Ips, 403 means somebody has a connection to Nginx, i just do not want that, just want it dropped.

return 444;

403 is the same as Deny in Apache.


Igor S.
http://sysoev.ru/en/