Home > Notes > awstats安装与配置

awstats安装与配置

Mon, 15 Jun 2009 05:32:35 +0800

为了对站点进行更有效的优化,我使用AWStats来进行分析和统计。在此之前得配置Nginx生成相关的访问记录,请参考我另一篇关于Nginx访问记录的配置文档。

wget http://prdownloads.sourceforge.net/awstats/awstats-6.9.tar.gz
tar zxf awstats-6.9.tar.gz
cd awstats-6.9
mv wwwroot /data/www/awstats.lewphee.com

安装GeoIP的C库
wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
tar zxf GeoIP.tar.gz
cd GeoIP
./configure
make && make install && make clean


perl -MCPAN -e 'install Geo::IP'
perl -MCPAN -e 'install Geo::IPfree'

下载GeoIP/GeoIPCityLite包:解包并部署到awstats目录下:
wget  http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
wget  http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz

gzip -d *.gz

复制通用可包含配置文件,当使用参数config时,awstats会找awstats.xxxx.conf的文件。所以把相同部分包含进来。如果不指定config时,awstats会找awstats.conf配置文件
cp awstats.model.conf awstats.common.conf

修改awstats.common.conf的一些配置选项:
LoadPlugin="decodeutfkeys"
LoadPlugin="geoip GEOIP_STANDARD /data/www/awstats.lewphee.com/cgi-bin/GeoIP.dat"
LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /data/www/awstats.lewphee.com/cgi-bin/GeoLiteCity.dat"

创建data目录用于统计数据输出:
mkdir data

然后生成awstats.lewphee.conf
Include "awstats.common.conf"
LogFile="/logs/www.lewphee.com/%YYYY-24%MM-24/access_%YYYY-24-%MM-24-%DD-24.log"
SiteDomain="www.lewphee.com"
HostAliases="lewphee.com"
DefaultFile="index.html"
DirData="/data/www/awstats.lewphee.com/cgi-bin/data/"

并修改awstats.pl: 设置LIMITFLUSH加10倍
$LIMITFLUSH=50000

自动更新:
在crontab那可以设置自动更新:
#update awstats
0 0 * * * (/data/www/awstats.lewphee.com/cgi-bin/awstats.pl -update -config=lewphee)

Tag:WEB, 服务器
Hots
评论
发表评论:


  [TIPS:首次发表评论的朋友,需要验证]
Tags
Recent Post
Recent Comments
Links
Copyright Notes
You can reship all of these articles without permission but MUST mark the original link in your post. Please contact with me() if u have advice or other arrangements.
Copyright©2007-2011 lewphee.com All rights reserved.