awstats在lighttpd下的安装配置

本文介绍如何在Lighttpd服务器环境下安装和配置Awstats,包括Perl环境搭建、下载Awstats软件包、配置Lighttpd模块及Awstats参数等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

awstats在lighttpd下的安装配置 笔记

本人对perl一窍不通,为了awstats,捣鼓了半天,特记录如下

awstats是一个很好用的站点日志统计工具, 本身是用perl实现的, lighttpd也可以使用awstats来进行统计工作

前提条件

机器上需要perl (废话).版本最好新一点,虽然awstats对版本要求不高,但awstats提供了一些很有用的plugin,这些plugin对perl的module和版本都有一些要求所以最好先升级到最新的5.x

安装新perl
  • linux: 下载最新的stable包....懒得写了
  • solaris:直接去sunfreeware下载现成的,下载下来 gunzip 以后用pkgadd -d 添加,注意要使新perl生效需拿/usr/local/bin/perl覆盖/usr/bin/perl,也可以在PATH中把/usr/local/bin提到/usr/bin前面

下载awstats

这里下载

wget http://mesh.dl.sourceforge.net/sourceforge/awstats/awstats-6.4.tgz
tar -xzvf awstats-6.4.tgz
cd  awstats-6.4

lighttpd 配置

lighttpd.conf中, 以下module需要打开(反注释掉即可)

mod_cgi
mod_access
mod_accesslog

添加对cgi的配置, 下面具体perl的目录视环境而定

cgi.assign = ( ".pl" => "/usr/bin/perl",".cgi" => "/usr/bin/perl" )

awstats 配置

1 修改awstats.model.conf的名字, 变更model为你自己的一个配置名字,下面提到的配置文件就是这个文件

mv wwwroot/cgi-bin/awstats.model.conf wwwroot/cgi-bin/awstats.myname.conf

2 配置awstat,确保如下修改,

LogFile="/path/to/access.log"  #和lighttpd中的accesslog地址一致,也就是实际上的accesslog文件路径

LogType=W 

LogFormat=1 #采用apache那样的日志格式

LogFormat = "%host %other %logname %time1 %methodurl %code %bytesd %refererquot %uaquot" #日志的字段配置

DirIcons="/awstats-support/icon" #这样是避免awstats用到的图片文件和原来的冲突

DirCgi="/cgi-bin-dir"  #替换默认的cgi-bin, 不知道为什么,反正我不喜欢cgi-bin这个名字

DirData="/path/to/yourdatadir" #数据文件存放地址,任意

SiteDomain="yourdomain" #改为你自己的域名

3 组装awstats,假定/path/to/yourwebdir是你的web根目录(对应"/")

mv wwwroot/cgi-bin/ /path/to/yourwebdir/cgi-bin-dir #和DirCgi 一致

mkdir /path/to/yourwebdir/awstats-support/ #和DirIcons一致

mv wwwroot/* /path/to/yourwebdir/awstats-support/ #复制资源

这些操作的结果是

  • 把awstats安装目录下的wwwroot/cgi-bin 放到 /path/to/yourwebdir/cgi-bin-dir
  • 把awstats安装目录下wwwroot/其他目录 放到 /path/to/yourwebdir/awstats-support

此时简单的awstats已经配置好, 重新启动以下lighttpd,然后执行

perl /path/to/yourwebdir/cgi-bin-dir/awstats.pl -update -config=myname

如果没有错误报告,就可以使用http://mydomain/cgi-bin-dir/awstats.pl?config=myname访问了 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值