推广 热搜: 行业  设备    参数  系统  经纪    教师  机械  中国 

Linux实现网站流量统计awstats

   日期:2024-11-07     作者:caijiyuan    caijiyuan   评论:0    移动:http://yishengsujiao.xhstdz.com/news/3062.html
核心提示:AWStats是在Sourcefroge上发展很快的一个基于perl的web日志分析工具,与其他工具相比,其优势在于1. 界面友好࿰

AWStats是在Sourcefroge上发展很快的一个基于perl的web日志分析工具,与其他工具相比,其优势在于

Linux实现网站流量统计awstats

1. 界面友好,可以根据浏览器直接调用相应的语言界面(支持中文

2.基于perl,并且很好的解决了跨平台的问题

3. 效率比较高,对于一个日访问量百万的网站,是可以承受的

4. 配置方便简单

5. 可以自由扩展

页面可以提供的信息

1、访问量,访问次数、页面浏览量、点击数、数据流量等。

2、精确到每月、每日、每小时的数据。

3、访问者国家。

4、访问者IP

5、robots/spiders的统计

6、访问者持续访问时间

7、文件类型的统计信息

8、客户的浏览器信息

实验环境

centos-5.5

使用软件

apache    awstats-7.0.tar.gz

软件安装

yum install -y httpd*         awstats-7.0.tar.gz

chmod +x awstats-7.0.tar.gz

tar zxvf awstats-7.0.tar.gz

mv awstats-7.0 /usr/local/awstats

cd /usr/local/awstats/tools/

perl awstats_configure.pl

---- AWStats awstats_configure 1.0 (build 1.9) (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: Linux, BSD or Unix

-----> Check for web server install


Enter full config file path of your Web server.

Example: /etc/httpd/httpd.conf

Example: /usr/local/apache2/conf/httpd.conf

Example: c:Program filesapache groupapacheconfhttpd.conf

Config file path ('none' to skip web server setup):

>/etc/httpd/conf/httpd.conf   apache 配置文件位置


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

 Add 'Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"'

 Add 'Alias /awstatscss "/usr/local/awstats/wwwroot/css/"'

 Add 'Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"'

 Add 'scriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"'

 Add '<Directory>' directive

 AWStats directives added to Apache config file.

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


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

> www.test.com                                             做日志访问的域名


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

>                                                         默认设置


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

>

-----> Create config file '/etc/awstats/awstats.www.test.com.conf'

Config file /etc/awstats/awstats.www.test.com.conf created.

-----> Restart Web server with '/sbin/service httpd restart'

Stopping httpd: [  OK  ]

Starting httpd: [  OK  ]

-----> 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=www.aabbcc.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.www.aabbcc.com.conf

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

You can then manually update your statistics for 'www.aabbcc.com' with command:

> perl awstats.pl -update -config=www.aabbcc.com

You can also read your statistics for 'www.aabbcc.com' with URL:

> http://localhost/awstats/awstats.pl?config=www.aabbcc.com

Press ENTER to finish...             到此配置完成


vim /etc/awstats/awstats.www.aabbcc.com.conf

找到    LogFile="/var/log/httpd/mylog.log"

改为    LogFile="/etc/httpd/logs/access_log"  次为apache的日志文件所在位置


      LogType=W


      LogFormat=1


      SiteDomain="www.aabbcc.com"


找到  DirData="/var/lib/awstats"

改为  DirDataa="/usr/local/awstats/data/"


mkdir -p /usr/local/awstats/data/         创建数据库存放目录

chmod -R 755 /usr/local/awstats/data/    

chmod -R 755 /usr/local/awstats/wwwroot/cgi-bin1 * * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=www.test.com -update

验证

输入 http://www.aabbcc.com/awstats/awstats.pl?config=www.aabbcc.com

如果出现访问保护,处理方法

1 关闭selinux,重启系统

2 给予适当的权限,实在不行(777,就能解决问题

本文地址:http://nhjcxspj.xhstdz.com/news/3062.html    物流园资讯网 http://nhjcxspj.xhstdz.com/ , 查看更多
 
标签: 网站
 
更多>同类行业资讯
0相关评论

新闻列表
企业新闻
推荐企业新闻
推荐图文
推荐行业资讯
点击排行
网站首页  |  关于我们  |  联系方式  |  使用协议  |  版权隐私  |  网站地图  |  排名推广  |  广告服务  |  积分换礼  |  网站留言  |  RSS订阅  |  违规举报  |  鄂ICP备2020018471号