Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
possible duplicate of Best way to block a country by IP address? – Michael Hampton Sep 10 '12 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 '12 at 13:44

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.