Windows2003/XP上AWstats安装教程

今天学习了在AWstats的安装教程,略有收获,还有待研究,希望各位仁兄指导!

教程如下:
感谢:
文章来自: http://www.servertechnology.cn/archives/693.html

win32 awstats 安装记 by Emerald 绿色学院 - Green Institute

一. awstats 简介
二. 下载 awstats
三. 安装 awstats
四. 下载和使用 cronolog
五. 设置 apache 的 httpd.conf 配置文件
六. 设置 AWStats
七. 更新 AWStats

/-*-------------------------------------------------------------------------------------*-/

一. awstats 简介

what is awstats

awstats is a free powerful and featureful tool that generates advanced web, streaming, ftp or mail server statistics, graphically. this log analyzer works as a cgi or from command line and shows you all possible information your log contains, in few graphical web pages. it uses a partial information file to be able to process large log files, often and quickly. it can analyze log files from all major server tools like apache log files (ncsa combined/xlf/elf log format or common/clf log format), webstar, iis (w3c log format) and a lot of other web, proxy, wap, streaming servers, mail servers and some ftp servers.
take a look at this comparison table for an idea on features and differences between most famous statistics tools (awstats, analog, webalizer,...).
awstats is a free software distributed under the gnu general public license. you can have a look at this license chart to know what you can/can't do.
as awstats works from the command line but also as a cgi, it can work with major web hosting provider which allow perl, cgi and log access.

you can browse awstats demo (real-time feature to update stats from web has been disabled on demos) to see a sample of most important information awstats shows you...

1. demo for web server log files
http://awstats.sourceforge.net/cgi-bin/awstats.pl

2. static demo for ftp log files
http://awstats.sourceforge.net/awstats.ftp.html

3. static demo for mail log files
http://awstats.sourceforge.net/awstats.mail.html

/-*-------------------------------------------------------------------------------------*-/

二. 下载 awstats
http://awstats.sourceforge.net/#download

----------------------------------------------------
注: 既然题目是安装记了, 嘻嘻, 那自然完全按我的方法进行.
----------------------------------------------------

我是下载 awstats-6.4.exe 自安装版本.

/-*-------------------------------------------------------------------------------------*-/

三. 安装 awstats

1. 运行 awstats-6.4.exe

2. 安装目录我设置 为: j:\awstats\

3.
#---------------------------------------------------
do you want me to build a new awstats config/proifle file
#---------------------------------------------------
选 y

4.
#---------------------------------------------------
your web site, virtual server or profile name:
#---------------------------------------------------
输入你网站的域名, 我的: gi.2288.org:88

5. 接着按两下 enter 键完成基本安装.

/-*-------------------------------------------------------------------------------------*-/

四. 下载和使用 cronolog
http://cronolog.org/download/index.html

win 32 version (zip file)

----------------------------------------------------
注: cronolog 功能主要是用于按天数截断 apache 日志.
----------------------------------------------------

1. 解压 cronolog-1.6.1-win32 zip 包.

2. 复制 cronolog.exe 到 apache 的 bin 目录,
我的是复制到:
#---------------------------------------------------
c:\program files\apache group\apache2\bin\
#---------------------------------------------------

/-*-------------------------------------------------------------------------------------*-/

五. 设置 apache 的 httpd.conf 配置文件

1. 打开 httpd.conf 文件.

2. 先注释掉以前的日志文件
例, 我以前的日志是:

#---------------------------------------------------
customlog logs/access_log.log common env=!image-request
#---------------------------------------------------

在前面加个#字符注释掉,例:
#---------------------------------------------------
#customlog logs/access_log.log common env=!image-request
#---------------------------------------------------

3. 重新定义日志记录文件
例:
#---------------------------------------------------
customlog "|bin/cronolog.exe logs/access_%y%m%d.log" combined env=!image-request
#---------------------------------------------------

4. 为 awstats 设置虚拟目录, 我是安装在 j:\awstats\
例:
#---------------------------------------------------
# awstats
alias /awstatsclasses "j:/awstats/wwwroot/classes/"
alias /awstatscss "j:/awstats/wwwroot/css/"
alias /awstatsicons "j:/awstats/wwwroot/icon/"
scriptalias /awstats/ "j:/awstats/wwwroot/cgi-bin/"

options +execcgi
allowoverride none
order allow,deny
allow from all

#---------------------------------------------------

5. 总结 apache httpd.conf 的设置
#---------------------------------------------------
##############################################################
## 避免对图片的请求出现在访问日志中
setenvif request_uri \.gif image-request
setenvif request_uri \.jpg image-request
setenvif request_uri \.png image-request
setenvif request_uri \.jpeg image-request

## 记录使用英语的请求到一个日志,而记录非英语的请求到另一个日志
#setenvif accept-language "en" english

#customlog logs/english_log.log common env=english
#customlog logs/non_english_log.log common env=!english
#customlog logs/access_log.log common env=!image-request

#customlog logs/access_log.log common env=!image-request
#customlog "logs/access_log.%y%m%d" combined env=!image-request
##############################################################

customlog "|bin/cronolog.exe logs/access_%y%m%d.log" combined env=!image-request

########################################################
# awstats
alias /awstatsclasses "j:/awstats/wwwroot/classes/"
alias /awstatscss "j:/awstats/wwwroot/css/"
alias /awstatsicons "j:/awstats/wwwroot/icon/"
scriptalias /awstats/ "j:/awstats/wwwroot/cgi-bin/"

options +execcgi
allowoverride none
order allow,deny
allow from all

########################################################
#---------------------------------------------------

6. 如果设置好的话, 重新启动 apache
#---------------------------------------------------
net stop apache2
net start apache2
#---------------------------------------------------

7. 一切顺利的话, 在 apache 的 log 目录应该有这样格式的日志显示
#---------------------------------------------------
access_20050309.log
#---------------------------------------------------

----------------------------------------------------
注: c:\program files\apache group\apache2\logs
----------------------------------------------------

8. 一切完成的话那就摆平 apache 方面的设置, 接着是 设置 awstats.

/-*-------------------------------------------------------------------------------------*-/

六. 设置 AWStats

1. 进入 J:\awstats\wwwroot\cgi-bin\ 目录

2. 打开 awstats.model.conf, 复制 awstats.model.conf 的内容到 awstats.gi.2288.org.conf 文件.
----------------------------------------------------
注: 我安装后 awstats.gi.2288.org.conf 里是空白的.
----------------------------------------------------

3. 查找 Logfile 字符串, 设置为:
#---------------------------------------------------
LogFile="C:\Program Files\Apache Group\Apache2\logs\access_%YYYY-24%MM-24%DD-24.log"
#---------------------------------------------------

4. 在 awstats.gi.2288.org.conf 文件里按 CTRL+F 查找 SiteDomain 字符串, 添加站点域名, 例:
#---------------------------------------------------
SiteDomain="gi.2288.org:88"
#---------------------------------------------------

5. 查找 HostAliases 字符串, 添加站点根域名, 我没有, 所以就让它成为默认状态.

6. 查找 DirData 字符串, 我的设置:
#---------------------------------------------------
DirData="."
#---------------------------------------------------

7. 查找 LoadPlugin="decodeutfkeys", 去掉前面的 # 字符, 例:
#---------------------------------------------------
#LoadPlugin="decodeutfkeys"
LoadPlugin="decodeutfkeys"
#---------------------------------------------------

8. AWStats 的设置完成大半部分了, 接着该是更新了, 要用到 Perl.
----------------------------------------------------
注: 不需要指定 Include"" 里的包含文件.
----------------------------------------------------

/-*-------------------------------------------------------------------------------------*-/

七. 更新 AWStats

1. 命令行方式 进入 Perl 安装目录的 Bin 目录, 例如我的:
#---------------------------------------------------
C:\Perl\bin>
#---------------------------------------------------

2. 运行下面的命令更新,例:
#---------------------------------------------------
perl J:\awstats\wwwroot\cgi-bin\awstats.pl -update -config=gi.2288.org
#---------------------------------------------------

显示为:
----------------------------------------------------
C:\Perl\bin>perl J:\awstats\wwwroot\cgi-bin\awstats.pl -update -config=gi.2288.
org
Update for config "J:\awstats\wwwroot\cgi-bin/awstats.gi.2288.org.conf"
With data in log file "C:\Program Files\Apache Group\Apache2\logs\access_2005030
8.log"...
Phase 1 : First bypass old records, searching new record...
Direct access after last parsed record (after line 52)
Jumped lines in file: 52
Found 52 already parsed records.
Parsed lines in file: 0
Found 0 dropped records,
Found 0 corrupted records,
Found 0 old records,
Found 0 new qualified records.

C:\Perl\bin>
----------------------------------------------------
###########################################################
############################################################
############################################################
# 注意在这个步骤折中我没有出现上面的显示结果,而是出现如下结果:
C:\Perl\bin>perl c:\AWStats\wwwroot\cgi-bin\awredir.pl --update -config=www.levomobile.com
----- awredir 1.1 (build 1.6) (c) Laurent Destailleur -----
This script is absolutely not required to use AWStats.
It's a third tool that can help webmaster in their tracking tasks but is not used by AWStats engine.

This tools must be used as a CGI script. When called as a CGI, it returns to
browser a redirector to tell it to show the page provided in 'url' parameter.
So, to use this script, you must replace HTML code for external links onto you
HTML pages from
<a href="http://externalsite/pagelinked">Link</a>
to
<a href="http://mysite/cgi-bin/awredir.pl?url=http://externalsite/pagelinked">
nk</a>

For your web visitor, there is no difference. However this allow you to track
clicks done on links onto your web pages that point to external web sites,
because an entry will be seen in your own server log, to awredir.pl script
with url parameter, even if link was pointing to another external web server.
############################################################
############################################################
###########################################################

3. 这时在 J:\awstats\wwwroot\cgi-bin 下会多了一个 awstats032005.gi.2288.org.txt 的文本文件.
##################################
也没有出现该文件。
##################################

4. 完成了...

/-*-------------------------------------------------------------------------------------*-/

附加: 在 AWStats 目录下有一个 DOC 目录, 里面有参考资料, 慢慢看, 还有很多用处, 我也是熟悉中.

################################################################
对于上面的原因可能是我本机上没有www.lenovomobile.com 这个域名的网站,
但是我把地址改为127.0.0.1 也不好使用,还有就是
options +execcgi
allowoverride none
order allow,deny
allow from all
这段配置我没有加,因为加上apache报错无法启动。

另外在安装AWstats前一定要安装perl:
ActivePerl-5.6.1.638-MSWin32-x86.msi
我对perl属于门外汉 可能是我配置的错误,
向大家请教, 谁能帮我解释一下出现的错误?谢谢了


你可能感兴趣的:(apache,XP,cgi,perl,Access)