Install mod_geoip from source with Apache 2.4

Here's how to do it:

Download the necessary packages:

GeoIP Database:

Because Piwik handles all my GeoIP database stuff I don't have to care about the installation and updates of the database itself. Your mileage may vary.

For official documentation see http://dev.maxmind.com/geoip/legacy/mod_geoip2/

I assume Apache 2.4 is already installed (from source - see Install Apache 2.4 from source with openssl and PFC)

We have to begin with geoip-api-c:

tar xzf GeoIP-latest.tar.gz
cd GeoIP-1.6.0
./configure
make
make install

This will install everything to to /usr/local/{bin,lib,include}

Next we are able to compile the module:

tar xzf mod_geoip2-latest.tar.gz
cd geoip-api-mod_geoip2-1.2.8
 
/opt/httpd/bin/apxs -i -a -L/usr/local/lib -I/usr/local/include -lGeoIP -c mod_geoip.c
 
#-I/usr/local/include is where the GeoIP.h header file is installed
#-L/usr/local/lib is where the libGeoIP library is located

mod_geoip should now be in your apache modules directory.

Configure the module in httpd.conf. Append the following snippet:

httpd.conf
 
<IfModule mod_geoip.c>
  GeoIPEnable On
  GeoIPDBFile /path/to/GeoIPCity.dat
</IfModule>

Reload your apache configuration and verify if the module has been loaded and configured properly.

apache/mod_geoip.txt · Last modified: 2014-06 by tb
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready