2 Second Way - Building mod_geoip From The Sources
If you've compiled lighttpd yourself, you should choose one of the following chapters. If you're using lighttpd 1.4.x, follow chapter 2.1, for lighttpd 1.5.x use chapter 2.2.
After the make command has succesfully finished, you should find mod_geoip.so in the /usr/local/src/lighttpd-1.4.13/src/.libs directory. This is all we need so we don't need to run make install. We can continue to use our old lighttpd installation and simply copy mod_geoip.so to the directory which contains our lighttpd modules (e.g. /usr/lib/lighttpd):
Now we must configure lighttpd to use mod_geoip. First, we download the GeoIP country database:
mkdir /usr/local/data
cd /usr/local/data
wget http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz
gunzip GeoIP.dat.gz
Then open /etc/lighttpd/lighttpd.conf and add "mod_geoip", to the server.modules section; also add the geoip.db-filename and geoip.memory-cache directives below the server.modules section:
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) (of course, PHP must be enabled in your lighttpd installation):
vi /var/www/geoiptest.php
<?php
print_r($_SERVER);
?>
Call that file in a browser, and it should display the SERVER array including values for GEOIP_COUNTRY_CODE, GEOIP_COUNTRY_CODE3, and GEOIP_COUNTRY_NAME(make sure that you're calling the file from a public IP address, not a local one).
If you want to use lighttpd + mod_geoip for your OpenX ad server, make sure you select MaxMind mod_apache GeoIP under Settings > Main Settings > Geotargeting Settings. This will work for lighttod + mod_geoip as well.
Recent comments
1 day 6 hours ago
2 days 5 hours ago
3 days 14 hours ago
4 days 47 min ago
4 days 11 hours ago
5 days 21 hours ago
1 week 2 days ago
1 week 2 days ago
1 week 3 days ago
1 week 3 days ago