cPanel: How to block visitor by country through GeoIP

To block a certain country IP range, you do not need to know which IP range it is and what you need is to use the GeoIP feature.

To install GeoIP, refer to the following URL,

Next, you will need to insert the following command to the .htaccess file,

RewriteEngine on
RewriteRule ^(.*)$ [L]

The command use to redirect China IP to***

***This is an example only and it is not to abuse any user/visitor reside in China.

cPanel: How to install mod_geoip

There are many ways to install mod_geoip in the web but the easiest way to compile it with cPanel server is to compile it through the easyapache.

To get it done, run the following command as root,

cd /var/cpanel/easy/apache/custom_opt_mods/
tar -zxf custom_opt_mod-mod_geoip.tar.gz

Next compile it with easyapache,


Then select the Mod_GeoIP in the Short Options List.

Enable Awstats GeoIP from Windows Operating System

For some reason, AwStats showing some IPs with unknown status. However, to get this fix, you may apply GeoIP plugin to your AwStats statistic.

1. Install Perl module.  Open your Perl Package Manager which is stand for ppm.bat in bin folder.
2. Install Geo-IP-PurePerl and Geo-IPfree module.
3. Download the GeoIP data from,
4. Extract the data and place it to C:\Perl\lib\Geo\IP folder.
5. Open the awstats.base.conf(C:\awstats\wwwroot\cgi-bin) and paste the following command.

LoadPlugin="geoip GEOIP_STANDARD C:\Perl\lib\Geo\IP\GeoIP.dat"

6. You have done and you will see the result in next update.