How to enable geoip in cpanel server


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
# 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
# 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/
GeoIPEnable On
GeoIPDBFile /usr/share/GeoIP/GeoIP.dat MemoryCache


There are no revisions for this post.

Tags: , , ,

No comments yet.

Leave a Reply