CentOS 安裝設定 AWStats 分析 http log

  • 安裝環境 : CentOS 5.8 i386
  • 透過 rpmforge Repository 來安裝
yum install awstats
(1/3): perl-Geo-IP-1.38-1.el5.rf.x86_64.rpm
(2/3): geoip-1.4.6-1.el5.rf.x86_64.rpm     
(3/3): awstats-7.0-2.el5.rf.noarch.rpm     
  • 目標分析兩個 log
    • aremgr (apache) : /var/log/httpd/access_log
    • ssl_svn (apache ssl) : /var/log/httpd/ssl_access_log
  • 建立兩個 config 檔
    cd /etc/awstats/
    cp awstats.model.conf awstats.aremgr.conf
    cp awstats.model.conf awstats.ssl_svn.conf
    • /etc/awstats/awstats.awstats.aremgr.conf.conf
      :
      SiteDomain="aremgr.ichiayi.com"
      :
    • /etc/awstats/awstats.awstats.aremgr.conf.conf
      :
      LogFile="/var/log/httpd/ssl_access_log"
      :
      LogFormat = "%host %other %logname %time1 %methodurl %code %bytesd
      :
      SiteDomain="aremgr-vpn.ichiayi.com"
      :
      ShowAuthenticatedUsers=1
      :
  • 設定 awstats 網頁存取權限
    • /etc/httpd/conf.d/awstats.conf
      :
      <Directory /var/www/awstats/>
          DirectoryIndex awstats.pl
          Options ExecCGI
      #    order deny,allow
      #    deny from all
      #    allow from 127.0.0.1
      </Directory>
      :
  • 設定每小時自動分析 log
    • /etc/cron.hourly/00awstats
      #!/bin/bash
      
      if [ -f /var/log/httpd/access_log ] ; then
          exec /usr/bin/awstats_updateall.pl now         -confdir="/etc"         -awstatsprog="/var/www/awstats/awstats.pl" >/dev/null
      fi
      exit 0
  • 透過 AWStats 網頁看成果
  • tech/awstats.txt
  • 上一次變更: 2012/04/09 19:49
  • jonathan