Jump to content
vBWarez - Rest In Peace

How To Install mod_geoip On a WHM/cPanel Server


Recommended Posts

Want to have Geoip running to block the nasties and never have to use.htaccess with thousands of lines to block bad countries LoL:blum2:

Here is answer:





- August, 23rd 2015 [B]mod_geoip[/B] is an API module released by [URL="http://www.maxmind.com/"]MaxMind[/URL] for Apache (or interchangeably, LiteSpeed) to quickly and easily obtain your website visitors’ geographical information. It offers high performance IP lookup especially when used together with PHP. [URL="http://www.maxmind.com/app/benchmark"]See benchmark[/URL]
While instructions to install [B]mod_geoip[/B] on Linux with Apache are easily available on the Internet, not much is written on how to install the module on WHM/cPanel servers. This tutorial will walk you through installing [B]mod_geoip[/B] on your WHM/cPanel step-by-step.
To be able to install [B]mod_geoip[/B] on your WHM/cPanel server, you must have root access and is able to SSH to your Virtual Private Server (VPS) / Hyrbrid Server / Dedicated Server. Note that for Shared or Reseller hosting users, you may have to contact your web host to get the module installed for you (warning: don’t expect it to be easy).
[B][U]Step 1: Log in to your VPS via SSH and create directory[/U][/B]
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

[B][U]Step 2: Download and install GeoIP database[/U][/B]
To download and install the GeoIP database provided by MaxMind, enter the following commands:
[CODE]wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gzip -d GeoIP.dat.gz [/CODE]
[B][U]Step 3: Download and install custom mod_geoip module for cPanel[/U][/B]
Next we will install the custom mod_geoip cPanel module created by Sohail Riaz. Simply enter the following commands:
[CODE]wget https://documentation.cpanel.net/download/attachments/2326651/custom_opt_mod-mod_geoip.tar.gz[/CODE]
tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf custom_opt_mod-mod_geoip.tar.gz
[B][U]Step 4: Rebuild Apache via EasyApache[/U][/B]
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
[B][U]Step 5: Load and enable mod_geoip[/U][/B]
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
And that’s it! [B]mod_geoip[/B] is now installed on your WHM/cPanel server in just 5 simple steps.
Originally posted 2013-03-01 23:03:30. Republished by windowsguru Edited by windowsguru
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...