如何使用 LAMP 堆栈阻止某些国家/地区访问我的网站?

hai*_*vgi 3 php lamp blocking apache-2.2

我有一个我不想被整个国家/地区查看的网站。该网站在 LAMP 服务器上运行。我怎样才能做到这一点?

小智 11

使用 mod_geoip 模块。 http://www.maxmind.com/app/mod_geoip

例如:

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
Run Code Online (Sandbox Code Playgroud)