2

I need to provide different webpage experiences based on geographies divided as Western, Asian, African audience etc.

I plan to do this with Nginx geo module by segmenting ip addresses and routing to the webserver with headers set from the Nginx reverse proxy

Now, where can I get the list of ipaddress blocks that can tell me if a user is from a e.g: western country, Asian etc?

Which is the canonical source to get this?

2
  • possible duplicate of Best way to block a country by IP address? Sep 10, 2012 at 23:07
  • It isn't a duplicate. That is about blocking access to specific countries, whereas this is about providing differing content based on country. They are related, but not exact duplicates, and there aren't many good answers to the suggested duplicate either.
    – dunxd
    Sep 12, 2012 at 13:44

1 Answer 1

3

Did you see this page about Creating geo.conf From MaxMind GeoIP Country Database? It's linked from the bottom of the nginx Geo Module you mentioned.

You will have to divide the countries up into categories (Western, Asian, African audience etc.) yourself but that shouldn't be too difficult.

If it were me doing this, I would do it in the app using one of the APIs that MaxMind provide with the actual data or pushing the data from the CSV file into my database. Don't forget that there are functions available to convert IP addresses from dotted-quad to numerical formats and back (ip2long(), INET_NTOA(), etc.) so you don't have to use the sample code given there.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .