Linux安装AWStats业务数据分析工具


Awstats是一个非常简洁而且强大的统计工具。它可以统计您站点的如下信息:
1:访问量,访问次数,页面浏览量,点击数,数据流量等精确到每月、每日、每小时的数据
2:访问者国家、访问者IP、操作系统、浏览器等
3:Robots/Spiders的统计
4:纺客持续时间
5:对不同Files type 的统计信息
6:Pages-URL的统计
7:其它信息(搜索关键字等等)

一、安装awstats

1. YUM安装方式:yum install awstats mod_perl  -y

2.源码安装方式:

下载地址:http://www.awstats.org/

# tar -zxvf awstats-7.3.tar.gz

# mv awstats-7.3/ awstats 

# mkdir /etc/awstats

# mkdir /var/lib/awstats

# chmod -R 777 awstats/

# cd /usr/local/awstats/tools/

# perl awstats_configure.pl

your web site ,virtual server or profile name: 你的网站服务器名或文件名 > /home/awstats/reports/logs.html

directory path to store config file(s) (enter for default): 目录路径存储配置文件(填写默认值) > /etc/awstats

3. 生成报告,执行定时任务

修改配置文件
cp /etc/awstats/awstats.localhost.localdomain.conf /etc/awstats/awstats.www.xxx.com.conf

编辑内容
vi /etc/awstats/awstats.www.xxx.com.conf

修改内容如下
LogFile=”/home/awstats/logs/access.log”
LogFormat=4
SiteDomain="www.xxx.com”
HostAliases="www.xxx.com localhost 127.0.0.1"
BuildHistoryFormat=xml
lang=cn

生成报告
/usr/share/awstats/wwwroot/cgi-bin/awstats.pl month=9 year=2021 -config=www.xx.com -lang=cn -update -output >/home/awstats/reports/9.html

4.apache 添加配置
Alias /awstatsclasses "/usr/share/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/share/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/share/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/share/awstats/wwwroot/cgi-bin/"

<Directory "/usr/share/awstats/wwwroot">
        Options Indexes FollowSymLinks
        DirectoryIndex index.html
        AllowOverride ALL
        Order Deny,Allow
        Allow from all
        Require all granted
    </Directory>