- 安装GeoIP
yum install GeoIP GeoIP-devel GeoIP-data zlib-devel
- 下载最新的IP数据
mkdir /usr/local/share/GeoIP cd /usr/local/share/GeoIP wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz gunzip GeoIP.dat.gz gunzip GeoLiteCity.dat.gz
- 安装 mod_geoip
yum install mod_geoip
- 修改apache配置
<IfModule mod_geoip.c> GeoIPEnable On GeoIPDBFile /usr/local/share/GeoIP/GeoIP.dat Standard GeoIPDBFile /usr/local/share/GeoIP/GeoLiteCity.dat Standard </IfModule>
5.检查
PHPinfo();
原文链接:https://www.f2er.com/centos/375398.html