awstats 웹로그 분석기 설치

굿굿임

# mkdir /etc/awstats
# mkdir /var/lib/awstats

# wget http://prdownloads.sourceforge.net/awstats/awstats-6.9.tar.gz
# tar zxvf awstats-6.9.tar.gz
# mv awstats-6.9.tar.gz /usr/local/awstats
# cd /usr/local/awstats/tools
# ./awstats_configure.pl

아래는 실행시 설정사항입니다~

[root@localhost tools]# ./awstats_configure.pl

—– AWStats awstats_configure 1.0 (build 1.8) (c) Laurent Destailleur —–
This tool will help you to configure AWStats to analyze statistics for
one web server. You can try to use it to let it do all that is possible
in AWStats setup, however following the step by step manual setup
documentation (docs/index.html) is often a better idea. Above all if:
– You are not an administrator user,
– You want to analyze downloaded log files without web server,
– You want to analyze mail or ftp log files instead of web log files,
– You need to analyze load balanced servers log files,
– You want to ‘understand’ all possible ways to use AWStats…
Read the AWStats documentation (docs/index.html).

—–> Running OS detected: Linux, BSD or Unix

—–> Check for web server install
Found Web server Apache config file ‘/usr/local/apache/conf/httpd.conf’

—–> Check and complete web server config file ‘/usr/local/apache/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
Add ‘Alias /awstatsclasses “/usr/local/awstats/wwwroot/classes/”‘
Add ‘Alias /awstatscss “/usr/local/awstats/wwwroot/css/”‘
Add ‘Alias /awstatsicons “/usr/local/awstats/wwwroot/icon/”‘
Add ‘ScriptAlias /awstats/ “/usr/local/awstats/wwwroot/cgi-bin/”‘
Add ‘‘ directive
AWStats directives added to Apache config file.

—–> 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

—–> Define config file name to create
What is the name of your web site or profile analysis ?
Example: http://www.mysite.com
Example: demo
Your web site, virtual server or profile name:
> msnote.co.kr

—–> 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.msnote.co.kr.conf’
Config file /etc/awstats/awstats.msnote.co.kr.conf created.

—–> Restart Web server with ‘/sbin/service httpd restart’
httpd: 인식되지 않은 서비스

—–> 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=msnote.co.kr
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…

=====================================================================================

# vi /usr/local/apache/conf/httpd.conf
설정사항 확인( 위처럼 진행하면 모든 설정사항이 자동으로 인서트됩니다~)

CustomLog “logs/access_log” combined

# Directives to allow use of AWStats as a CGI
#
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/”

#
# This is to permit URL access to scripts/files in AWStats directory.
#
<directory “=”” usr=”” local=”” awstats=”” wwwroot”=””>
Options None
# AllowOverride None
AllowOverride All < < == 이부분은 apache 인증하기위해서 바꿈.원래는 위에 주석된값
Order allow,deny
Allow from all

vi /etc/awstats/awstats.msnote.conf 설정~
#LogFile=”/var/log/httpd/mylog.log”
LogFile=”/usr/local/apache/logs/access_log”

Lang=”ko”

두개만바꿔주믄됨~

인증 설정~( 아무나못드가가게 바꾸는거지용~
[root@localhost wwwroot]# pwd
/usr/local/awstats/wwwroot

vi .htaccess
======================================================
AuthName “User Authorization”
AuthType Basic
AuthUserFile /usr/local/awstats/wwwroot/.htpasswd
AuthGroupFile /dev/null
require valid-user
======================================================

/usr/local/apache/bin/htpasswd -c .htpasswd master // 패스워드설정 경로잘보셈

크론설정 ( 5분에한번씩 글거오기~)
[root@localhost wwwroot]# crontab -l
*/5 * * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=msnote

리다이렉트설정~(그냥그냥 접속편하게~)
# vi /usr/local/apache/conf/extra/httpd-vhosts.conf
ServerName awstats.msnote.co.kr
Redirect / http://msnote.co.kr/awstats/awstats.pl?config=msnote

[root@localhost wwwroot]# /usr/local/apache/bin/apachectl -t
Syntax OK
[root@localhost wwwroot]# /usr/local/apache/bin/apachectl restart

재시작~

로그인해볼까요~

awstats.msnote.co.kr gogo~

/usr/local/awstats/tools/awstats_updateall.pl -awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -configdir=/etc/awstats/ now 이거슨 설정된 모든 사이트 전체업데이트~

One Comment so far:

  1. master says:

    AddType application/x-httpd-cgi .pl
    AddHandler cgi-script .cgi .pl

    LoadModule cgid_module modules/mod_cgid.so

Leave your Comment

Your email address will not be published. Required fields are marked *