Installing PHP-GEOIP on Ubuntu 18.04 LTS with Apache

From Thom's wiki
Jump to navigation Jump to search

To install the GeoIP extensions on Ubuntu 18.04 LTS with Apache issue the following commands:

 sudo apt-get install php-geoip libapache2-mod-geoip geoip-database geoip-database-extra

Enble the GeoIP module

 sudo a2enmod geoip

Edit the configuration file /etc/apache2/mods-available/geoip.conf as follows:

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

And restart the Apache Webserver

 sudo systemctl restart apache2