1. AWStats 다운로드
http://awstats.sourceforge.net/
# cd /etc
# wget http://prdownloads.sourceforge.net/awstats/awstats-6.7.tar.gz
2. 압축풀기 & 이동
# tar xvfz awstats-6.7.tar.gz
# mv awstats-6.7 awstats
# mv awstats /usr/local/awstats
3. 설치
# cd /usr/local/awstats
// 설정 파일이 저장될 폴더와, DB 파일이 저장될 폴더를 생성해 둔다.
// 관리 편의를 위해 한 곳 폴더 만든다.
# mkdir conf // default = /etc/awstats
# mkdir db // default = /var/lib/awstats
# cd /usr/local/awstats/tools
# ./awstats_configure.pl
.........
/// apache 의 로그 포맷을 바꿀거냐고 물으면 y 입력
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/apache2/apache2.conf //아파치 설정 파일의 경로를 입력한다.
-----> Check and complete web server config file '/etc/apache2/apache2.conf'
-----> 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 // config 파일 설정.
...........
...........
Your web site, virtual server or profile name: // 서버이름 입력.
> localhost
-----> Define config file path
In which directory do you plan to store your config file(s) ? // config 파일의 저장 위치
Default: /etc/awstats
Directory path to store config file(s) (Enter for default):
> /usr/local/awstats/conf ?// 입력하지 않고 엔터를 치면 default 폴더 /etc/awstats 로 지장된다.
-----> Create config file '/etc/awstats/awstats.withcom.kr.conf'
Config file /etc/awstats/awstats.withcom.kr.conf created.
-----> Add update process inside a scheduler
// config 파일은 awstats.서버이름.conf 로 생성된다.
엔터
엔터
?
4. config 설정
# cd /usr/local/awstats/conf
# vi awstats.localhost.conf
#Lang="auto"
#한글화 하기
Lang="ko"
#로그파일 위치 지정 = 분석에 사용할 로그 파일을 지정
#LogFile="/var/log/httpd/mylog.log"
LogFile="/usr/local/apache2/logs/access_log"
#로그파일 종류 defualt = web log = W
LogType=W
#로그파일의 기록 형식 지정 default = apache = 1
#1-Apache or Lotus Notes.......
#2-IIS or ISA
#3-Webstar native log format
#4-Apache or Squid native common log format
LogFormat=1
#AWStats database 파일을 저장할 디렉토리 지정
#DirData="/var/lib/awstats #default
DirData="/usr/local/awstats/db"
5. Apache2/conf/httpd.conf 파일 변경
1) awstats를 Apache 에 등록
(awstats 을 apache 에 등록시키는 스크립트는 awstats 를 설치하면 httpd.conf 맨 뒤에 자동으로 삽입된다.)???????????????????
# 자동 삽입되는 내용
Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
Alias /awstatsicons/ "/usr/local/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"
<Directory "/usr/local/awstats/wwwroot">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
2) Apache Logformat 변경
( Apache 는 처음 설치시 default LogFormat = common 이지만
AWStats 분석에는 combined LogFormat 을 사용한다. )
AWStats 설치시 Apache 로그포맷을 common 에서 combined 으로 바꿀 거냐고 묻는데
거기서 y 를 선택했다면 자동으로 바뀐다.
#CustomLog logs/access_log # default common
CustomLog logs/access_log combined
#옵션 사항
#SetEnvIfNoCase Request_URI (gif|png|jpg|css|js|bmp|jpeg|swf)$ IMAGE=1
#CustomLog /usr/local/apache/logs/access_log combined env=!img-nosave,!CodeRedNimda
( VirtualHost 를 등록한 경우 LogFormat 변경 )
<VirtualHost *:80>
ServerName localhost
DocumentRoot /export/home/www
#Customlog logs/access_log common
Customlog logs/access_log combined
......
......
</VirtualHost>
# apachectl restart // 저장 종료 후 아파치 재시작
6. awstats DB 업데이트
# /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=localhost
!!!! 주의1 !!!!
awstats 설치시 conf 파일 저장 위치를 defualt ( /etc/awstats ) 로 쓰지않고 사용자 정의 했을때
conf 파일 을 찾을 수 없다는 에러가 나타날 수 있다.
# cd /usr/local/awstats/wwwroot/cgi-bin
# vi awstats.pl
( function Read_config() 를 찾아 $Dir 변수 값을 바꿔준다.)
( awstats 설치시 config 경로를 제대로 설정했는데 왜 안됬는지 모르겠다.)
( 이건 땜빵 처리이다. 정확한 해결책을 못 찾았음 )
sub Read_Config {
# Check config file in common possible directories :
# Windows : "$DIR" (same dir than awstats.pl)
# Standard, Mandrake and Debian package : "/etc/awstats"
# Other possible directories : "/usr/local/etc/awstats", "/etc"
# FHS standard, Suse package : "/etc/opt/awstats"
#my $configdir=shift;
my $configdir='/usr/local/awstats/conf';
!!!! 주의2 !!!!!
apache 를 새로 설치한 경우가 아니라면
apache 로그에 common Logfomat 으로 로그를 남기는데
common format 은 awstats 가 파싱을 못하기 때문에 업데이트시 에러가난다.
로그파일의 내용을 모두 지운다.
7. 확인
( 웹 브라우저 시작 )
http://localhost/awstats/awstats.pl?config=localhost
# /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=localhost
이 명령어로 awstats DB 를 업데이트 해야 웹페이지 통계가 업데이트 된다.
8. 기타
이 버전에서 Cron 은 지원하지 않지만
Web에서 Update 할 수 있는 Update Now 버튼을 사용 할 수 있다.
# cd /usr/local/awstats/con // default = /etc/awstats
# vi awstats.localhost.conf
#AllowToUpdateStatsFromBrowser=0
AllowToUpdateStatsFromBrowser=1
// write 권한을 준다.
# cd /usr/local/awstats // default = /var/lib
# chmod 777 db // default = awstats
AWStats GeoIP 플러그인 사용
GeoIP 설치
요즘은 GeoIP 가 업데이트를 하지 않아 Yum으로 설치 해야한다.
# yum list|grep GeoIP
GeoIP.i686 1.6.5-1.el6 epel
GeoIP.x86_64 1.6.5-1.el6 epel
GeoIP-GeoLite-data.noarch 2018.04-1.el6 epel
GeoIP-GeoLite-data-extra.noarch 2018.04-1.el6 epel
GeoIP-devel.i686 1.6.5-1.el6 epel
GeoIP-devel.x86_64 1.6.5-1.el6 epel
python-GeoIP.x86_64 1.2.5-0.2.20090931cvs.el6 epel
# yum install GeoIP.x86_64
설치 후 /usr/share/GeoIP 폴더에 설치가된다.
GeoIP 플러그인을 사용하기 위해 AWStats 설정 파일에 1312라인과 1352라인에 적절하게 수정합니다.
[root@yongbok ~]# vi /etc/awstats/awstats.ruo91.conf
# Plugin: GeoIP
LoadPlugin="geoip GEOIP_STANDARD /usr/local/share/GeoIP/GeoIP.dat"
# Plugin: GeoIP_City_Maxmind
LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /usr/local/share/GeoIP/GeoLiteCity.dat"

댓글목록
등록된 댓글이 없습니다.