您的位置:首页 > 运维架构 > Linux

Linux下“网站流量访问统计”软件“awstats”的配置安装使用过程

2011-08-14 16:07 1551 查看
1.从官网下载最新的的awstats,解压缩

# unzip awstats-6.95.zip

# mv awstats-6.95 /usr/local/awstats

2. 安装配置awstats,以我服务器上的网站phpadmin.dean.com为例,根据情况请自行更改网址

[root@server56 LAMP]# cd /usr/local/awstats/
[root@server56 awstats]# mkdir -m 755 data
[root@server56 awstats]# perl tools/awstats_configure.pl
-----> Check for web server install

Found Web server Apache config file '/etc/httpd/httpd.conf' <=============读取你的httpd配置文件

-----> Check and complete web server config file '/etc/httpd/httpd.conf'

All AWStats directives are already present.

-----> Update model config file '/usr/local/awstats/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 <===============第一次需要创建一个新的config fiel

-----> 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:

> phpadmian.dean.com <====================这里输入你要记录的网址,当然是自己httpd服务器上的

-----> Define config file path

In which directory do you plan to store your config file(s) ?

Default: /etc/awstats

Directory path to store config file(s) (Enter for default):

> <================配置文件存放路径,一般默认/etc/awstats即可,直接回车

-----> Create config file '/etc/awstats/awstats.phpadmin.dean.com.conf'

Config file /etc/awstats/awstats.phpadmin.dean.com.conf created.

-----> Add update process inside a scheduler

Sorry, configure.pl does not support automatic add to cron yet.

You can do it manually by adding the following command to your cron:

/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=phpadmin.dean.com

Or if you have several config files and prefer having only one command:

/usr/local/awstats/tools/awstats_updateall.pl now

Press ENTER to continue... <====================按回车创建。。。

A SIMPLE config file has been created: /etc/awstats/awstats.phpadmin.dean.com.conf

You should have a look inside to check and change manually main parameters.

You can then manually update your statistics for 'phpadmin.dean.com' with command:

> perl awstats.pl -update -config=phpadmin.dean.com

You can also read your statistics for 'phpadmin.dean.com' with URL:

> http://localhost/awstats/awstats.pl?config=phpadmin.dean.com

Press ENTER to finish... <=============创建成功,按回车退出

3.修改配置文件/etc/awstats/awstats.drupal.dean.com.conf ,找到logFile那一行,将其修给为自己网站的访问日志路径,并且增加一样DataDir指向上面创建的data目录
vim /etc/awstats/awstats.drupal.dean.com.conf


LogFile="/usr/local/apache/logs/druap.dean.com-access_log"

DataDir="DataDir="/usr/local/awstats/data"

4.生成统计日志网页。

1)首先需要创建/var/lib/awstats目录,否则在生成日志网页的时候报错

mkdir /var/lib/awstats
2)确保你的网站访问日志格式为combined ,否则会报错

This means each line in your web server log file need to have "combined log format" like this:

3)确保awstats.pl有执行权限,否则无法生成日志网页

chmod +x /usr/local/awstats/wwwroot/cgi-bin/awstats.pl
4)生成日志网页

cd /usr/local/awstats/wwwroot/cgi-bin
perl awstats.pl updata -config=phpadmin.dean.com
5. 查看日志网页

在浏览器里输入:http://phpadmin.dean.com/awstats/awstats.pl?config=phpadmin.dean.com

效果如下



6.可以将以上命令放到crontab中执行,并根据需要指定更新的频率和时间:

33 6 * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=phpadmin.dean.com >/dev/null 2>&1
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐