CentOS 为 Apache 安装GeoIP 支持

  1. 安装GeoIP
yum install GeoIP GeoIP-devel GeoIP-data zlib-devel
  1. 下载最新的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
  1. 安装 mod_geoip
yum install mod_geoip
  1. 修改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();

CentOS 为 Apache 安装GeoIP 支持

相关推荐