How to block access to your site from certain country

Customers can create country-based protection with custom rules:

Solution found here:
How to Block Entire Countries from Accessing Your Website — SitePoint

Add following custom rules to mod_security config (for plugin users: Userdata - > Custom Rules, for standalone install please modify file /etc/cwaf/httpd/custom_user.conf)
Here is a sample rule for mod_security to block China:

SecGeoLookupDb /path/to/geo/data/GeoIP.dat
SecRule REMOTE_ADDR "[at]geoLookup" "chain,id:20,drop,msg:'Block China IP address'"
SecRule GEO:COUNTRY_CODE "[at]streq CN"

Note: replace ‘[at]’ with ‘commercial at’ sign.
GeoIP database can be found here:

cPanel users can use following:
log in to WHM and go to Security Center->ModSecurity Configuration. Scroll down to “Geolocation Database” and put in the path to GeoIP.dat
Add lines to mod_security config:

SecRule REMOTE_ADDR "[at]geoLookup"  "phase:1,chain,id:10,drop,log,msg:'Blocking China IP Address'"
SecRule GEO:COUNTRY_CODE "[at]streq CN"

Restart your web server.
That’s all folks. :P0l