GeoIPCity with nginx

Maxim Dounin mdounin at mdounin.ru
Sun Nov 23 00:05:48 MSK 2008


Hello!

On Sat, Nov 22, 2008 at 05:18:31PM +0100, Bobby Dr wrote:

> Hello list!
> 
> I know Maxmind's GeoIP Country database can be used easily with nginx.
> But what about their Geo-City database?
> 
> The default CSV database stands at > 100MB in size (and will grow even
> larger if the two normalized files are merged together). For this
> reason, using the CIDR format may not be feasible (due to excessive
> memory requirement)
> 
> The binary file is much smaller however.

The problem with maxmind's city database afaik is that text 
information they provide aren't cidrs, but ip ranges.  This is 
generaly good for relation databases, but worst case for those who 
are able to work with cidrs.

Binary file afaik is radix tree dump with real cidrs, that's why it's 
much smaller.

Theoretically it should be possible to collapse ip ranges to 
optimal set of cidr's to make this usable with native nginx geo 
module, but this isn't really easy task.

> Has anybody been able to use the geo-city database with nginx? For
> apache MaxMind provides mod_geoip which works on the binary file, making
> it very fast.
> 
> Does anyone have any solution (like mod_geoip) for nginx? I'm using PECL
> geoip for PHP and the one for ruby. But I feel, geo lookup at the server
> level would be much faster.
> 
> Is there any official/3rd party geo-city module for nginx?

AFAIK, no.

Maxim Dounin





More information about the nginx mailing list