{"id":1423,"date":"2014-04-25T22:28:02","date_gmt":"2014-04-25T20:28:02","guid":{"rendered":"https:\/\/www.hostking.host\/blog\/?p=1423"},"modified":"2014-04-25T22:28:02","modified_gmt":"2014-04-25T20:28:02","slug":"install-mod-geoip-whmcpanel-server","status":"publish","type":"post","link":"https:\/\/www.hostking.host\/blog\/install-mod-geoip-whmcpanel-server\/","title":{"rendered":"How To Install mod_geoip On a WHM\/cPanel Server"},"content":{"rendered":"<p><b>mod_geoip<\/b>&nbsp;is an API module released by&nbsp;<a style=\"color: #bc0c0c;\" href=\"http:\/\/www.maxmind.com\/\" rel=\"nofollow noopener\" target=\"_blank\">MaxMind<\/a>&nbsp;for Apache to quickly and easily obtain your website visitors\u2019 geographical information. It offers high performance IP&nbsp;lookup&nbsp;especially when used together with PHP.<\/p>\n<p>While instructions to install&nbsp;<b>mod_geoip<\/b>&nbsp;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&nbsp;<b>mod_geoip<\/b>&nbsp;on your WHM\/cPanel step-by-step.<\/p>\n<p>To be able to install&nbsp;<b>mod_geoip<\/b>&nbsp;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 us&nbsp;to get the module installed for you (warning: we will need to schedule this).<\/p>\n<p><b>Step 1: Log in to your VPS via SSH and create directory<\/b><br \/>\nOpen up your SSH client (PuTTY) and log in to your VPS as root user. Then enter the following commands:<\/p>\n<p><code style=\"color: #666666;\">mkdir \/usr\/share\/GeoIP<br \/>\ncd \/usr\/share\/GeoIP<br \/>\n<\/code><\/p>\n<p><b>Step 2: Download and install GeoIP database<\/b><br \/>\nTo download and install the GeoIP database provided by MaxMind, enter the following commands:<\/p>\n<p><code style=\"color: #666666;\">wget http:\/\/geolite.maxmind.com\/download\/geoip\/database\/GeoLiteCountry\/GeoIP.dat.gz<br \/>\ngzip -d GeoIP.dat.gz&nbsp;<\/code><\/p>\n<p><b>Step 3: Download and install custom mod_geoip module for cPanel<\/b><br \/>\nNext we will install the custom mod_geoip cPanel module created by&nbsp;Sohail Riaz. Simply enter the following commands:<\/p>\n<p><code style=\"color: #666666;\">wget http:\/\/docs.cpanel.net\/twiki\/pub\/EasyApache\/EasyApacheCustomModules\/custom_opt_mod-mod_geoip.tar.gz<br \/>\ntar -C \/var\/cpanel\/easy\/apache\/custom_opt_mods -xzf custom_opt_mod-mod_geoip.tar.gz<\/code><\/p>\n<p><b>Step 4: Rebuild Apache via EasyApache<\/b><br \/>\nNow 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.<\/p>\n<p><code style=\"color: #666666;\">WHM -&gt; Software -&gt; EasyApache (Apache Update) -&gt; Start customizing based on profile -&gt; Check 'Mod GeoIP' option (on Short \/ Exhaustive Options List page) -&gt; Save and Build<\/code><\/p>\n<p><b>Step 5: Load and enable mod_geoip<\/b><br \/>\nAfter 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:<\/p>\n<p><code style=\"color: #666666;\">WHM -&gt; Service Configuration -&gt; Apache Configuration -&gt; Include Editor -&gt; Pre Main Include -&gt; Select the current Apache version&nbsp;<\/code><\/p>\n<p>Second, enter the following codes into the textbox:<\/p>\n<p><code style=\"color: #666666;\">LoadModule geoip_module \/usr\/local\/apache\/modules\/mod_geoip.so<br \/>\nGeoIPEnable On<br \/>\nGeoIPDBFile \/usr\/share\/GeoIP\/GeoIP.dat MemoryCache&nbsp;<\/code><\/p>\n<p>And that\u2019s it!&nbsp;<b>mod_geoip<\/b>&nbsp;is now installed on your WHM\/cPanel server in just 5 simple steps.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>mod_geoip&nbsp;is an API module released by&nbsp;MaxMind&nbsp;for Apache to quickly and easily obtain your website visitors\u2019 geographical information. It offers high performance IP&nbsp;lookup&nbsp;especially when used together with PHP. While instructions to&hellip;<\/p>\n","protected":false},"author":2,"featured_media":1426,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"class_list":["post-1423","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-website-and-web-hosting","entry"],"_links":{"self":[{"href":"https:\/\/www.hostking.host\/blog\/wp-json\/wp\/v2\/posts\/1423","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostking.host\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostking.host\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostking.host\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostking.host\/blog\/wp-json\/wp\/v2\/comments?post=1423"}],"version-history":[{"count":0,"href":"https:\/\/www.hostking.host\/blog\/wp-json\/wp\/v2\/posts\/1423\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostking.host\/blog\/wp-json\/wp\/v2\/media\/1426"}],"wp:attachment":[{"href":"https:\/\/www.hostking.host\/blog\/wp-json\/wp\/v2\/media?parent=1423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostking.host\/blog\/wp-json\/wp\/v2\/categories?post=1423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostking.host\/blog\/wp-json\/wp\/v2\/tags?post=1423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}