awstats分析web日志


下载地址:http://nchc.dl.sourceforge.net/project/awstats/AWStats/7.0/awstats-7.0.tar.gz


# tar zxf awstats-6.9.tar.gz
# mv awstats-6.9 /usr/local/apache/awstats

# mv /usr/local/apache/htdocs/* /usr/local/apache/awstats/wwwroot            (即把原网站内容放

到/usr/local/apache/awstats/wwwroot下面)
# cd /usr/local/apache/awstats/tools
# perl awstats_configure.pl 
     在[y/N]提示时,输入y
     Your web site, virtual server or profile name: 
     >www.benet.com      回车
     Press ENTER to finish。。。 回车
     Press ENTER to finish。。。 回车

4.配置

# vi /etc/awstats/awstats.www.benet.com.conf
     LogFile="/usr/local/apache/logs/access_log"
     DirData="/usr/local/apache/awstats/data"
     DirCgi="/usr/local/apache/awstats/wwwroot/cgi-bin"

     DirIcons="/usr/local/apache/awstats/wwwroot/icons"
     AllowToUpdateStatsFromBrowser=1

5.设置权限

# chown -R root:root /usr/local/apache/awstats
# chmod -R 755 /usr/local/apache/awstats
# mkdir /usr/local/apache/awstats/data
# chown nobody.nobody  /usr/local/apache/awstats/data
# chmod 777 /usr/local/apache/awstats/data
# chmod 755 /usr/local/apache/awstats/wwwroot/cgi-bin/*.pl

7.修改网站配置文件
  
# vi /usr/local/apache/conf/httpd.conf

    ....

    CustomLog     combinedServerTokens   Full                   (第102行)

    ....

    <VirtualHost 192.168.1.2>
    DocumentRoot   /usr/local/apache/awstats/wwwroot
    ServerName     www.benet.com
    CustomLog      logs/access_log  combined
    </VirtualHost>

    :wq

# /usr/local/apache/bin/apachectl restart
8.生成分析日志与静态查看界面

# cd /usr/local/apache/htdocs/awstats/wwwroot/cgi-bin
# perl awstats.pl -config=www.benet.com -update -lang=cn
# perl awstats.pl -config=www.benet.com -output