소스파일 다운로드

AWStats - Free log file analyzer for advanced statistics (GNU GPL) 사이트에서 Last Stable 버전 다운로드

압축 해제

tar xvzfo awstats-7.4.tar.gz

디렉토리 이동

mv awstats-7.4 /data/service/awstats

Configuration

unply.com 호스트를 셋업한다고 가정

mkdir /data/service/awstats/data
mkdir /etc/awstats
cp /data/service/awstats/wwwroot/cgi-bin/awstats.model.conf /etc/awstats/awstats.unply.com.conf

복사된 /etc/awstats/awstats.unply.com.conf 파일을 수정

Before
LogFile="/var/log/httpd/mylog.log"
SiteDomain=""
HostAliases="localhost 127.0.0.1 REGEX[myserver\.com$]"
DirData="."
AllowFullYearView=2
URLReferrerWithQuery=0
After
LogFile="/var/log/httpd/unply.com-access.log"
SiteDomain="unply.com"
HostAliases="localhost 127.0.0.1 unply.com www.unply.com"
DirData="/data/service/awstats/data"
AllowFullYearView=3
URLReferrerWithQuery=1

Apache Config 수정

<VirtualHost *:80>
	ServerName awstats.unply.com
	DocumentRoot "/data/service/awstats/wwwroot"

	ErrorLog "/var/log/httpd/awstats.unply.com-error.log"
	CustomLog "/var/log/httpd/awstats.unply.com-access.log" combined

	Alias /awstatscss "/data/service/awstats/wwwroot/css/"
	Alias /awstatsicons "/data/service/awstats/wwwroot/icon/"
	Alias /awstatsclasses "/data/service/awstats/wwwroot/classes/"
	ScriptAlias /awstats/ "/data/service/awstats/wwwroot/cgi-bin/"
</VirtualHost>

통계 분석 실행

/data/service/awstats/wwwroot/cgi-bin/awstats.pl -config=unply.com

crontab 등록

/etc/crontab 파일에 매 시간 실행되도록 추가

59 * * * * root /data/service/awstats/wwwroot/cgi-bin/awstats.pl -config=unply.com > /dev/null 2>&1