Since writing this tutorial, I now only recommend using the <a href="https://sick.codes/install-maxmind-geoip-centos-7-vestacp/">new MaxMind APIs which I've written a tutorial on here</a>. This tutorial is based off <a href="http://www.leeladharan.com/installing-and-enabling-mod-geoip2-on-apache-2-centos-7" target="_blank" rel="noopener noreferrer">Installing and Enabling mod_geoip2 on Apache 2 (centOS 7)</a> and <a href="http://www.linux-faqs.info/apache/block-or-redirect-using-mod-geoip" target="_blank" rel="noopener noreferrer">Block or redirect using mod_geoip</a>. Install "development tools" <code>yum groupinstall 'Development Tools'</code> Install geoip and other tools <code>yum install GeoIP GeoIP-devel GeoIP-data zlib-devel geoip-devel</code> Download mod_geoip2 module <code>wget https://github.com/maxmind/geoip-api-mod_geoip2/archive/1.2.10.tar.gz tar -zxvf 1.2.10.tar.gz cd geoip-api-mod_geoip2-1.2.10</code> Load a dummy module <code>echo "#LoadModule foo_module /usr/lib/apache2/modules/foo.so" >> /etc/httpd/conf/httpd.conf</code> Install mod_geoip2 <code>apxs -i -a -L/usr/local/lib -I/usr/local/include -lGeoIP -c mod_geoip.c</code> Restart httpd <code>/bin/systemctl restart httpd.service</code> Check if the module is loaded <code>cat /etc/httpd/conf/httpd.conf # should show: # LoadModule geoip_module /usr/lib64/httpd/modules/mod_geoip.so</code> Download the data to a folder called opt/geoip <code>mkdir /opt/geoip cd /opt/geoip wget --content-disposition "isp database file url (right click, copy link from maxmind downloads area" wget --content-disposition "http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz" </code> Unzip and untar the ISP database <code>tar -xzvf GeoIP*.tar.gz cd GeoIP* mv *dat .. cd .. ls</code> Gunzip the GEO database <code>gunzip GeoIP.dat.gz ls</code> You should see the two databases <code>/opt/geoip/GeoIP.dat /opt/geoip/GeoIPISP.dat</code> Add the two databases to the httpd configuration file <code>vi /etc/httpd/conf/httpd.conf</code> <code><IfModule geoip_module> GeoIPEnable On GeoIPOutput All GeoIPScanProxyHeaders On GeoIPEnableUTF8 On GeoIPDBFile /opt/geo/GeoIP.dat Standard GeoIPDBFile /opt/geo/GeoIPISP.dat Standard </IfModule></code> Restart httpd <code>/bin/systemctl restart httpd.service</code> Check if geoip module is loaded <code>apachectl -t -D DUMP_MODULES | grep geoip</code> Go to web folder, /var/www/, or on VestaCP <code>cd /home/admin/web/*/public_html/ vi .htaccess</code> Add to .htaccess <code>SetEnvIf GEOIP_COUNTRY_CODE RU BlockCountry Deny from env=BlockCountry</code> Use a VPN or <a href="http://teleport.to/" target="_blank" rel="noopener noreferrer">teleport.to</a> service to check if you are blocked from specific Geo location.