WAMP 下 awstats 配置

3 篇文章 0 订阅
2 篇文章 0 订阅

1、配置好wamp apache 支持Perl

可以参见前面的文章《WAMP Apache 配置 Perl》

2、下载awstats-7.8

https://awstats.sourceforge.io/#DOWNLOAD
下载7.8的最新版本
解压缩后把整个目录复制至C:\wamp64\www下
在这里插入图片描述

3、运行awstats_configure.pl

cd C:\wamp64\www\awstats-7.8\tools
perl awstats_configure.pl

在这里插入图片描述

输入C:\wamp64\bin\apache\apache2.4.51
在这里插入图片描述

输入C:\wamp64\bin\apache\apache2.4.51\conf\httpd.conf
在这里插入图片描述

输入y
在这里插入图片描述

输入mylocalweb

在这里插入图片描述

下面是该命令输出的文本截取,供参考:

C:\Users\Wuser>cd C:\wamp64\www\awstats-7.8\tools

C:\wamp64\www\awstats-7.8\tools>perl awstats_configure.pl

----- AWStats awstats_configure 1.0 (build 20140126) (c) Laurent Destailleur -----
This tool will help you to configure AWStats to analyze statistics for
one web server. You can try to use it to let it do all that is possible
in AWStats setup, however following the step by step manual setup
documentation (docs/index.html) is often a better idea. Above all if:
- You are not an administrator user,
- You want to analyze downloaded log files without web server,
- You want to analyze mail or ftp log files instead of web log files,
- You need to analyze load balanced servers log files,
- You want to 'understand' all possible ways to use AWStats...
Read the AWStats documentation (docs/index.html).

-----> Running OS detected: Windows

-----> Check for web server install
awstats_configure did not find your Apache web main runtime.

Please, enter full directory path of your Apache web server or
'none' to skip this step if you don't have local web server or
don't have permission to change its setup.
Example: c:\Program files\apache group\apache
Apache Web server path ('none' to skip):
> C:\wamp64\bin\apache\apache2.4.51

Now, enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:\Program files\apache group\apache\conf\httpd.conf
Config file path ('none' to skip web server setup):
> C:\wamp64\bin\apache\apache2.4.51\conf\httpd.conf

-----> Check and complete web server config file 'C:\wamp64\bin\apache\apache2.4.51\conf\httpd.conf'
  Add 'Alias /awstatsclasses "../wwwroot/classes/"'
  Add 'Alias /awstatscss "../wwwroot/css/"'
  Add 'Alias /awstatsicons "../wwwroot/icon/"'
  Add 'ScriptAlias /awstats/ "../wwwroot/cgi-bin/"'
  Add '<Directory>' directive
  AWStats directives added to Apache config file.

-----> Update model config file '..\wwwroot\cgi-bin\awstats.model.conf'
  File awstats.model.conf updated.

-----> Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y

-----> Define config file name to create
What is the name of your web site or profile analysis ?
Example: www.mysite.com
Example: demo
Your web site, virtual server or profile name:
> mylocalweb

-----> Create config file '..\wwwroot\cgi-bin\awstats.mylocalweb.conf'
 Config file ..\wwwroot\cgi-bin\awstats.mylocalweb.conf created.

-----> Add update process inside a scheduler
Sorry, for Windows users, if you want to have statistics to be
updated on a regular basis, you have to add the update process
in a scheduler task manually (See AWStats docs/index.html).
Press ENTER to continue...


A SIMPLE config file has been created: ..\wwwroot\cgi-bin\awstats.mylocalweb.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'mylocalweb' with command:
> perl awstats.pl -update -config=mylocalweb
You can also read your statistics for 'mylocalweb' with URL:
> http://localhost/awstats/awstats.pl?config=mylocalweb

Press ENTER to finish...

C:\wamp64\www\awstats-7.8\tools>

实际这上面还表述了一下,在Windows中定时任务需要自己配置。

4、配置wamp中Apache的配置

4.1 更改httpd.conf中最后添加的内容,因为自动插入的内容是为Apache 2.2 以前的版本配置的,现在Apache是2.4,所以需要更改。
4.2 同时要更改项目的目录位置。
4.3 更改日志输出格式。

4.1和4.2调整如下:

Alias /awstatsclasses "C:/wamp64/www/awstats-7.8/wwwroot/classes/"
Alias /awstatscss "C:/wamp64/www/awstats-7.8/wwwroot/css/"
Alias /awstatsicons "C:/wamp64/www/awstats-7.8/wwwroot/icon/"

ScriptAlias /awstats/ "C:/wamp64/www/awstats-7.8/wwwroot/cgi-bin/"

<Directory "C:/wamp64/www/awstats-7.8/wwwroot">
    AllowOverride all
    Options all
    Require local
    Options +Indexes +FollowSymLinks +Multiviews
</Directory>

4.3 调整如下

更改日志格式,在httpd.conf中搜索CustomLog “${INSTALL_DIR}/logs/access.log” common,做如下更改

    # CustomLog "${INSTALL_DIR}/logs/access.log" common
CustomLog "${INSTALL_DIR}/logs/access.log" combined

如果不更改,后面运行时将报错

C:\wamp64\www\awstats-7.8\wwwroot\cgi-bin>perl awstats.pl -config=mylocalweb -update
Create/Update database for config "./awstats.mylocalweb.conf" by AWStats version 7.8 (build 20200416)
From data in log file "C:/wamp64/logs/access.log"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
AWStats did not find any valid log lines that match your LogFormat parameter, in the 50th first non commented lines read of your log.
Your log file C:/wamp64/logs/access.log must have a bad format or LogFormat parameter setup does not match this format.
Your AWStats LogFormat parameter is:
1
This means each line in your web server log file need to have "combined log format" like this:
111.22.33.44 - - [10/Jan……………………………

5、修改脚本生成的配置文件

就是前面第3步生成的配置文件,要指向自己的Apache日志位置
修改C:\wamp64\www\awstats-7.8\wwwroot\cgi-bin\awstats.mylocalweb.conf

LogFile="C:/wamp64/logs/access.log"
Lang="cn"
AllowToUpdateStatsFromBrowser=1

6、修改脚本执行的命令解释器位置

修改C:\wamp64\www\awstats-7.8\wwwroot\cgi-bin\awstats.pl
把第一行#!/usr/bin/perl
改为

#!C:/Strawberry/perl/bin/perl.exe

7、重启wamp中的Apache服务

访问并点击几下Apache页面中的内容,以便acces.log中有数据

8、更新Apache日志数据

运行:

cd C:\wamp64\www\awstats-7.8\wwwroot\cgi-bin

perl awstats.pl -config=mylocalweb -update

C:\wamp64\www\awstats-7.8\wwwroot\cgi-bin>perl awstats.pl -config=mylocalweb -update
Create/Update database for config "./awstats.mylocalweb.conf" by AWStats version 7.8 (build 20200416)
From data in log file "C:/wamp64/logs/access.log"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 90
 Found 0 dropped records,
 Found 0 comments,
 Found 0 blank records,
 Found 0 corrupted records,
 Found 0 old records,
 Found 90 new qualified records.

C:\wamp64\www\awstats-7.8\wwwroot\cgi-bin>

9、访问awstats页面

用浏览器访问http://localhost/awstats/awstats.pl?config=mylocalweb

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值