概述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.驗證