In this tutorial we’ll install the Debian Linux 9 (squeeze), Apache 2 with mpm-itk (to run each web as a isolated user),...
Installing the GeoIP Apache moduleÁstþór IP
This module allows you to determine which country, region, city, postal code, area code the visitor is coming from.
1. Install the module
apt-get install libapache2-mod-geoip
2. Restart Apache
3. Create a new PHP file to test the module (pico /var/www/test.php or any file you can access on your server)
4. Navigate to the new file in a web browser (http://yourserver/test.php)
The response will be something like this:
[GEOIP_COUNTRY_CODE] => GB
[GEOIP_COUNTRY_NAME] => United Kingdom
I’ve installed OK on Debian 2.6.18 and I’ve also uncommented the /etc/apache2/modules-available/geoip.conf line
which information elsewhere suggests is needed.
However running a simple PHP test script produces the output
Country name : N/A
Country code : —
So, either it really doesn’t know which country my IP is in (unlikely) or I’ve done something wrong. Anyone got any suggestions?