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.檢查php

phpinfo();

圖片描述

相關文章
相關標籤/搜索