概述html
AWStats是免费的一个很是强大的日志分析工具的Apache日志文件。 从apache分析日志后,它以易于理解的图形格式显示它们。 它是高级Web统计的缩写,它能够在命令行界面或CGI上运行。 linux
功能 web
它能够统计您站点的以下信息: apache
一:访问量,访问次数,页面浏览量,点击数,数据流量等 vim
二:精确到每个月、每日、每小时的数据 centos
三:访问者国家 浏览器
四:访问者IP 安全
五:Robots/Spiders的统计 服务器
六:访客持续时间 ide
七:对不一样Files type 的统计信息
八:Pages-URL的统计
九:访客操做系统浏览器等信息
十:其它信息(搜索关键字等等)
实验环境
系统环境:centos 6.5
服务器IP地址:192.168.100.10
yum挂载目录:/mnt/sr0
awstats软件包挂载到linux系统中
awstats软件包 百度网盘连接:https://pan.baidu.com/s/1WeO74SxuKhmEm3k4U02cNg 密码:czog
实验目的
1.学会部署awstats分析系统
2. 优化网页地址
3.设置awstats网页访问认证
实验步骤
1.安装awstats软件包
[root@localhost ~]# mount.cifs //192.168.100.8/ww /abc /挂载软件包到linux里面
[root@localhost ~]# tar zxvf awstats-7.6.tar.gz -C /opt/ > /dev/null /解压软件到opt目录下
[root@localhost ~]# mv /opt/awstats-7.6 /usr/local/awstats /移动软件到/usr/local/目录下
2.为要统计的站点创建配置文件
[root@localhost ~]# cd /usr/local/awstats/tools /切换目录
[root@localhost tools]# chmod +x awstats_configure.pl /赋予脚本执行权限
[root@localhost tools]# ./awstats_configure.pl /执行脚本
(1)指定httpd主配置文件路径
----- AWStats awstats_configure 1.0 (build 20140126) (c) Laurent Destailleur
This tool will help you to configure AWStats to analyze statistics for
……(省略部份内容)
-----> 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 files\apache group\apache\conf\httpd.conf
Config file path ('none' to skip web server setup):
> /etc/httpd/conf/httpd.conf /输入httpd.conf配置文件路径
(2)设置日志类型
----> Check and complete web server config file '/usr/local/httpd/conf/httpd.conf'
Warning: You Apache config file contains directives to write 'common' log files
This means that some features can't work (os, browsers and keywords detection).
(3)为指定web建立配置文件
-----> 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 /是否须要建立AWStats的配置文件,选择"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:
-----> 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.bt.com.conf'
Config file /etc/awstats/awstats.www.bt.com.conf created.
-----> Restart Web server with '/sbin/service httpd restart'
-----> 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.bt.com
Or if you have several config files and prefer having only one command:
/usr/local/awstats/tools/awstats_updateall.pl now
A SIMPLE config file has been created: /etc/awstats/awstats.www.bt.com.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'www.bt.com' with command:
\> perl awstats.pl -update -config=www.bt.com
You can also read your statistics for 'www.bt.com' with URL:
3.搭建httpd服务
[root@localhost ~]# yum -y install httpd
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf /修改主配置文件
ServerName www.benet.com:80 /域名
Listen 192.168.100.10:80 /监听地址
[root@Iocal ~]# service httpd start /启动httpd服务
[root@localhost ~]# cd /mnt/sr0/Packages/
[root@localhost Packages]# rpm -ivh bind-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm
[root@localhost ~]# vim /etc/named.conf
[root@localhost ~]# cd /var/named/
[root@localhost named]# cp -p named.localhost benet.com.zone /将模板文件改成正向解析文件进行修改
[root@localhost ~]# vim /var/named/benet.com.zone /修改正向解析文件
(4) 启动dns服务
[root@localhost ~]# service named start
5.修改站点统计配置文件
[root@localhost named]# vim /etc/awstats/awstats.www.benet.com.conf
[root@localhost named]# mkdir /var/lib/awstats /建立指定目录
6.执行日志分析
[root@localhost named]# service iptables stop /关闭防火墙
[root@localhost named]# setenforce 0 /关闭安全性
7.手动更新网页数据
8.设置周期性计划任务表
[root@localhost tools]# crontab –e /设置周期性任务计划表
[root@localhost tools]# service crond start /启动周期性任务服务
9.网页地址优化
[root@localhost tools]# cd /var/www/html
[root@localhost html]# vim awb.html
<html>
<head>
<meta http-equiv=refresh content="0;url=http://www.benet.com/awstats/awstats.pl?config=www.benet.com">
</head>
<body></body>
</html>
10.查看优化效果,使用http://www.benet.com/awb.html 访问
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf
12.验证