How to block countries using Geo IP
Posted: Sat Feb 06, 2010 7:21 pm
You can use the GeoIP Apache API to block unwanted countries.
For example, the following Apache configuration directives uses GeoIP Country to block traffic from China and Russia.
For example, the following Apache configuration directives uses GeoIP Country to block traffic from China and Russia.
Code: Select all
GeoIPEnable On
GeoIPDBFile /path/to/GeoIP.dat
SetEnvIf GEOIP_COUNTRY_CODE CN BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE RU BlockCountry
# ... place more countries here
Deny from env=BlockCountry
# Optional - use if you want to allow a specific IP address from the country you denied
# (See http://httpd.apache.org/docs/1.3/mod/mod_access.html for more details)
Allow from 10.1.2.3