Hello,
Geo IP module is used to block access for certain countries to the websites. This is done by a module named mod_Geoip on the apache. Below is the steps to enable and configure Geo IP on a Cpanel linux servers .
1.Install GeoIP binaries:
yum install GeoIP GeoIP-devel
2.You can download more databases from MaxMind and put them into /opt/geoip/share/GeoIP/:
http://geolite.maxmind.com/download/geoip/database/
3.install CPanel EasyApache GeoIP module:
View details: http://www.cpanel.net/apps/easyapache/custom.html
Download mod_GeoIP:
wget http://easyapache.cpanel.net/optmods/custom_opt_mod-mod_geoip.tar.gz
tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf custom_opt_mod-mod_geoip.tar.gz}
Steps 2 and 3 are optional as Geo IP module is already enabled on the easy apache.
4. Run EasyApache and select mod GeoIP:
/scripts/easyapache
5.configure GeoIP by adding to httpd.conf (or pre_virtualhost_global.conf):
/usr/local/apache/conf/httpd.conf
/usr/local/apache/conf/includes/pre_virtualhost_global.conf
LoadModule geoip_module modules/mod_geoip.so
<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /var/lib/GeoIP.dat
</IfModule>
6.Install GeoIP PHP Extension:
Install geoip via PECL:
pecl install geoip
7.Restart Apache:
/scripts/restartsrv_apache
8.After this has been done we can test if the Geo IP was enabled by adding some rules on .htaccess of a website .
edit .htaccess of a website and add the following lines to it
SetEnvIF GEOIP_COUNTRY_CODE CN BlockThese
SetEnvIF GEOIP_COUNTRY_CODE TR BlockThese
# Add more countries here
Deny from env=BlockThese
A full list of 2 digit country codes can be found here: http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
The above listed in the example are "CN = China" and "TR = Turkey"
Regards
Syamkumar.M
Geo IP module is used to block access for certain countries to the websites. This is done by a module named mod_Geoip on the apache. Below is the steps to enable and configure Geo IP on a Cpanel linux servers .
1.Install GeoIP binaries:
yum install GeoIP GeoIP-devel
2.You can download more databases from MaxMind and put them into /opt/geoip/share/GeoIP/:
http://geolite.maxmind.com/download/geoip/database/
3.install CPanel EasyApache GeoIP module:
View details: http://www.cpanel.net/apps/easyapache/custom.html
Download mod_GeoIP:
wget http://easyapache.cpanel.net/optmods/custom_opt_mod-mod_geoip.tar.gz
tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf custom_opt_mod-mod_geoip.tar.gz}
Steps 2 and 3 are optional as Geo IP module is already enabled on the easy apache.
4. Run EasyApache and select mod GeoIP:
/scripts/easyapache
5.configure GeoIP by adding to httpd.conf (or pre_virtualhost_global.conf):
/usr/local/apache/conf/httpd.conf
/usr/local/apache/conf/includes/pre_virtualhost_global.conf
LoadModule geoip_module modules/mod_geoip.so
<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /var/lib/GeoIP.dat
</IfModule>
6.Install GeoIP PHP Extension:
Install geoip via PECL:
pecl install geoip
7.Restart Apache:
/scripts/restartsrv_apache
8.After this has been done we can test if the Geo IP was enabled by adding some rules on .htaccess of a website .
edit .htaccess of a website and add the following lines to it
SetEnvIF GEOIP_COUNTRY_CODE CN BlockThese
SetEnvIF GEOIP_COUNTRY_CODE TR BlockThese
# Add more countries here
Deny from env=BlockThese
A full list of 2 digit country codes can be found here: http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
The above listed in the example are "CN = China" and "TR = Turkey"
Regards
Syamkumar.M
No comments:
Post a Comment