Awstats

出自 Alpine Linux

AWStats 是一个强大的工具,用于生成服务器统计信息。Awstats 可以作为 CGI 运行或从命令行运行,并以图形方式显示日志中包含的所有可能信息。

安装 Lighthttpd 和 Awstats

基本安装

要安装额外的软件包,首先激活 community 软件包仓库并更新软件包索引

安装所需的软件包

# apk add lighttpd php82 fcgi php82-cgi

配置 Lighttpd

编辑 lighttpd.conf (/etc/lighttpd/lighttpd.conf) 并取消注释该行

/etc/lighttpd/lighttpd.conf的内容

... include "mod_fastcgi.conf" ...

编辑 mod_fastcgi.conf (/etc/lighttpd/mod_fastcgi.conf),找到并更改 /usr/bin/php-cgi/usr/bin/php-cgi82

/etc/lighttpd/mod_fastcgi.conf的内容

... "bin-path" => "/usr/bin/php-cgi82" # php-cgi ...

启动 lighttpd 服务并添加到默认运行级别

# rc-service lighttpd start # rc-update add lighttpd default

安装 Awstats

apk add awstats -U

/etc/lighttpd/lighttpd.conf

/etc/lighttpd/lighttpd.conf的内容

... 更改基本服务器根文件夹 #server.document-root = var.basedir + "/htdocs" server.document-root = "/usr/lib/awstats" ...

配置 Awstats

运行 awstats_configure.pl

awstats_configure.pl

   -----> Running OS detected: Linux, BSD or Unix
   Do you want to continue setup from this NON standard directory [yN] ? y
   
   -----> Check for web server install
   Config file path ('none' to skip web server setup): none
   -----> Need to create a new config file ?  y
   
   -----> Define config file name to create
   Example: www.mysite.com
   Example: demo
   Your web site, virtual server or profile name: awstats
   
   -----> Define config file path
   >/etc/awstats 
   
   Press ENTER to continue...
   Press ENTER to finish...

编辑 awstats.awstats.conf

   nano /etc/awstats/awstats.awstats.conf 
   Search the line LogFile=" " and configure your log path and file. e.g. LogFile="/var/log/messages"

启动 http 服务器并添加到启动项

rc-service lighttpd start && rc-update add lighttpd default

浏览

   http://AWSTATS_IP_NUMBER/cgi-bin/awstats.pl?config=awstats

注意:Awstats 尚不适用于 dansguardian 日志。