Install and enable mod_geoip
sudo apt-get install libapache2-mod-geoip
sudo a2enmod geoip rewrite
sudo service apache2 restart
Apache config to block Brazil
GeoIPEnable On
GeoIPScanProxyHeaders On
GeoIPDBFile /usr/share/GeoIP/GeoIP.dat
SetEnvIf GEOIP_COUNTRY_CODE BR BlockCountry
Deny from env=BlockCountry
Links
- [[2025-W29]]