Loading ...






Open up your SSH client (PuTTY) and log in to your VPS as root user. Then enter the following commands:

# mkdir /usr/share/GeoIP
# cd /usr/share/GeoIP
# cd GeoIP 

To download and install the GeoIP database provided by MaxMind, enter the following commands:

# wget https://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
# gzip -d GeoIP.dat.gz 

Next we will install the custom mod_geoip cPanel module created by Sohail Riaz. Simply enter the following commands:

# wget https://twiki.cpanel.net/twiki/pub/EasyApache3/CustomMods/custom_opt_mod-mod_geoip.tar.gz
# tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf custom_opt_mod-mod_geoip.tar.gz

Now that we have installed the GeoIP database and all the modules required to run mod_geoip with 
Apache and cPanel, we will need to rebuild Apache in WHM.

WHM -> Software -> EasyApache (Apache Update) -> Start customizing based on profile -> 
Check 'Mod GeoIP' option (on Short / Exhaustive Options List page) -> Save and Build

After Apache has been rebuilt with mod_geoip, we will need to load and enable the module every time Apache runs. First, in WHM, go to:

WHM -> Service Configuration -> Apache Configuration -> Include Editor -> Pre Main Include -> Select the current Apache version

Second, enter the following codes into the textbox:

LoadModule geoip_module /usr/local/apache/modules/mod_geoip.so
GeoIPEnable On
GeoIPDBFile /usr/share/GeoIP/GeoIP.dat MemoryCache