Debian Admin

Debian/Ubuntu Linux System Administration Tutorials,Howtos,Tips

  • RSS Subscribe

    subscribe to the Debian Admin RSS feed
  • Sponsors



  • Categories

  • Sponsors

  • Support DebianAdmin

    Amount $:
    Website(Optional):


  • Meta

  • Archives



How to setup GeoIP support for apache2 On Debian Etch

Posted by Admin on April 11th, 2008

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

This is an apache2 module for finding the country that a web request originated from. It uses the GeoIP library and database to perform the lookup.This module only works on Apache 2.0.x servers.

First you need to make sure you have apache2 server installed and working fine.

Installing mod_geoip in Debian etch using the following command

#aptitude install libapache2-mod-geoip

This will complete the installation

Configuring Geoip

Now you need to open /etc/apache2/mods-available/geoip.conf file and uncomment the GeoIPDBFile line so that the file looks as follows

#vi /etc/apache2/mods-available/geoip.conf

<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /usr/share/GeoIP/GeoIP.dat
</IfModule>

Now you need to restart Apache using the following command

#/etc/init.d/apache2 restart

Test Geoip

To see if mod_geoip is working correctly, we can create a small PHP file in one of our web spaces (e.g. /var/www):

#vi /var/www/geoiptest.php

add the following lines and save the file


open browser http://serverip/geoiptest.php, and it should display your country.

  • Share/Bookmark

One Response to “How to setup GeoIP support for apache2 On Debian Etch”

  1. Rytis Says:

    Hey,
    nice article, but it’s a bit confusing. There are way to get country data of another IPs?

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>