AWStats GeoIP 插件

  | 转载时请务必以超链接形式标明文章原文链接和作者信息及本版权声明。
原文链接:http://www.liaojl.com/archives/2007/10/awstats-geoip.html

通过GeoIP插件,在AWStats报表中,可以显示IP地址来自那个国家和地区。

下载Geo::IP和GeoIP C API的源代码,先安装 GeoIP C API

tar zxvf GeoIP.tar.gz
cd GeoIP-1.3.14
./configure
make
make install

接下来安装Geo:IP perl模块,因为需要使用GeoIP的动态链接库文件,修改/etc/ld.so.conf并添加路径:

/usr/local/lib

执行命令ldconfig /etc/ld.so.conf使更改生效,然后安装Geo:IP:

tar zxvf Geo-IP-1.27.tar.gz
cd Geo-IP-1.27
perl Makefile.PL
make
make test
make install

通过Google下载免费的GeoIP Free Country数据库文件。并解压缩到/etc/awstats/GeoIP.dat。

修改AWStats的站点配置文件,添加以下设置:

LoadPlugin="geoip GEOIP_STANDARD /etc/awstats/GeoIP.dat"

这样就可以解析IP地址来自那个国家,使用这个插件会影响8%的性能。

Leave a comment

Archives

Creative Commons License
This blog is licensed under a Creative Commons License.