Welcome! Log In Create A New Profile

Advanced

Re: GeoIP

Ruslan Ermilov
September 08, 2015 03:52AM
On Tue, Sep 08, 2015 at 02:22:56AM -0400, agz wrote:
> map я использую. в секции http:
> geoip_country /usr/share/GeoIP/GeoIP.dat;
> map $geoip_country_code $allowed_country {
> default yes;
> US no;
> UK no;
> }
> Или что то другое Вы имели ввиду?

Можно одновременно определять страну и по списку:

geo $geo_country {
127.0.0.1 RU;
10.0.0.0/8 RU;
}

и по базе GeoIP:

map $geo_country $country {
'' $geoip_country_code;
default $geo_country;
}

Как это работает: если клиентского адреса нет в списке
geo, то страна ($country) определяется по базе GeoIP.

Blacklist по странам также можно сделать при помощи map:

map $country $restricted {
XX 1;
YY 1;
ZZ 1;
}

Останется предпринять нужные действия:

if ($restricted) {
return 403;
}

_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

geoip

slyab February 19, 2015 12:30AM

Re: geoip

Anton Yuzhaninov February 19, 2015 06:02AM

Re: geoip

Andrey Kopeyko February 19, 2015 03:22PM

Re: geoip

Andrey Kopeyko February 19, 2015 05:20PM

Re: geoip

slyab February 19, 2015 09:52PM

Re: geoip

slyab February 20, 2015 12:30AM

Re: geoip

Andrey Kopeyko February 20, 2015 04:44AM

Re: geoip

slyab February 20, 2015 05:05AM

Re: geoip

Oleg Motienko February 25, 2015 04:00PM

Re: GeoIP

mva September 07, 2015 04:18PM

Re: GeoIP

Dmitry Ivanov September 08, 2015 01:10AM

Re: GeoIP

agz September 08, 2015 02:02AM

Re: GeoIP

Sergey Bochkov September 08, 2015 02:10AM

Re: GeoIP

agz September 08, 2015 02:22AM

Re: GeoIP

Ruslan Ermilov September 08, 2015 03:52AM

Re: GeoIP

agz September 08, 2015 04:04AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 86
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready