To install GeoIP Apache module on CentOS 7, run
yum -y install GeoIP GeoIP-devel GeoIP-data yum -y install mod_geoip
Now you need to configure Apache VirtualHost.
To block traffic, add following to your VirtualHost entry
RewriteEngine On RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(CN|RU|A1)$ RewriteRule ^(.*)$ https://serverok.in [L]
In this example, traffic from CN, RU and A1 (stands for proxy IP) get redirected to specified URL.