概述
AWStats是免费的一个非常强大的日志分析工具的Apache日志文件。 从apache分析日志后,它以易于理解的图形格式显示它们。 它是高级Web统计的缩写,它可以在命令行界面或CGI上运行。
功能
它可以统计您站点的如下信息:
一:访问量,访问次数,页面浏览量,点击数,数据流量等
二:精确到每月、每日、每小时的数据
三:访问者国家
四:访问者IP
五:Robots/Spiders的统计
六:访客持续时间
七:对不同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).
Do you want me to setup Apache to write 'combined' log files [y/N] ? y /将日志格式转换成combined,显示更为详细
(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:
> www.benet.com /绑定网站域名,虚拟主机名或者自定义配置名,可以同时支持多个站点进行观测。
我的是www.benet.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):
> /定义配置文件路径,直接点击回车默认是在/etc/awstats目录下
-----> 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
Press ENTER to continue... /直接点击回车跳过
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:
> http://localhost/awstats/awstats.pl?config=www.benet.com /注意访问awstats的URL
Press ENTER to finish… /点击回车结束
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服务
4.搭建DNS服务器
(1)安装bind软件包
[root@localhost ~]# cd /mnt/sr0/Packages/
[root@localhost Packages]# rpm -ivh bind-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm
(2) 修改主配置文件named.conf
[root@localhost ~]# vim /etc/named.conf
(3) 创建并修改DNS正向解析文件
[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
http://www.benet.com/awstats/awstats.pl?config=www.benet.com">
10.查看优化效果,使用http://www.benet.com/awb.html 访问
11.设置awstats网页访问认证
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf
12.验证