How to install mod_geoip On WHM/cPanel server

Mod_GeoIP module is used to get the geographic location of ipaddress of the visitor into the Apache web server. This module allows you to determine the visitor’s country, organization and location.

This article explain the procedure to enable mod_geoip in cpanel server.

Step1: Log in to your server via SSH.

Step2: Create the directory for saving Geoip database.

# mkdir /usr/share/GeoIP

Step3: Change the location to the newly created folder.

# cd /usr/share/GeoIP

Step4: Download and install GeoIP database.

# wget

Step5: Extract the downloaded database file.

# gzip -d GeoIP.dat.gz

Step 6: Download the custom mod_geoip module for cPanel.

# wget

Step7: Extract the downloaded file to the cpanel custom modules location.

# tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf custom_opt_mod-mod_geoip.tar.gz

Step 8: Rebuild Apache via EasyApache

# /scripts/easyapache

Step 9: Load and enable mod_geoip. Open the file '/usr/local/apache/conf/includes/pre_main_global.conf' and save the below lines.

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

Step10: Restart httpd service

# /etc/init.d/httpd restart

Leave a Reply

Your email address will not be published. Required fields are marked *