[prev in list] [next in list] [prev in thread] [next in thread] 

List:       nginx
Subject:    Re: Using GeoIP2
From:       Francis Daly <francis () daoine ! org>
Date:       2019-06-21 7:46:04
Message-ID: 20190621074604.kugb72sgkvokupzr () daoine ! org
[Download RAW message or body]

On Wed, Jun 19, 2019 at 08:05:13PM -0500, Peter Fraser wrote:

Hi there,

> geoip2 /usr/local/etc/nginx/GeoIP2/GeoIP2-Country.mmdb {
> auto_reload 5m;
> $geoip2_metadata_country_build metadata build_epoch;
> $geoip2_data_country_code default=US source=$variable_with_ip country iso_code;
> $geoip2_data_country_name country names en;
> }

> I am realizing I don't fully understand what all this does. The part \
> source=$variable_with_ip country iso_code. I am trying to understand, what should \
> go there.

A web search for "nginx geoip2 module" pointed me to
https://www.nginx.com/products/nginx/modules/geoip2/ and to
https://github.com/leev/ngx_http_geoip2_module; and the first does also
point to the second.

The documentation there says "If source is not specified, $remote_addr
will be used to perform the lookup" (the surrounding context is probably
helpful for those docs).

My reading of that is that, assuming the (common) case where the IP
address that you want to geo-locate is in the nginx variable $remote_addr,
you can either write source=$remote_addr, or omit source= entirely.

The rest of that config line is described in those docs -- very roughly as
"like what the mmdblookup tool does".

I hope this helps,

	f
-- 
Francis Daly        francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic