awstate 설치(자세히/오류해결포함) 및 권한설정-아파치 로그 웹통계 툴

1)파일 다운로드

 

- http://awstats.sourceforge.net다운로드 파일은 이 사이트에서 최신버전확인

 

-받는 위치는 /root경로

 

-아래는 다운로드 명령어

wget http://prdownloads.sourceforge.net/awstats/awstats-7.7.tar.gz

tar.gz
awstats 다운로드

 

2)압축풀기

tar xvfz awstats-7.7.tar.gz

awstats 압축풀기

 

 

 

3)풀더 이동

mv awstats-7.7 /usr/local/awstats/

 

 

4)웹에서 접근 가능하도록 퍼미션 변경

chmod -R 755 /usr/local/awstats/

 

 

5)환경설정 파일이 위치할 디렉토리 생성

mkdir /etc/awstats

 

 

6)데이터 파일이 위치할 디렉토리 생성

mkdir /var/lib/awstats

 

 

7) awstats_configure.pl 컴파일

//해당 디렉토리로 이동

cd /usr/local/awstats/tools/

 

//awstats_configure.pl실행

./awstats_configure.pl

awstats_configure.pl

 

 

 

//httpd.conf 경로를 입력

ex) >/xxx/xxx/httpd.conf  

아파치 httpd.conf 경로

 

 

 

 

 

//컨피그 파일 생성

y

컨티그 파일 생성할지

 

 

 

 

 

-도메인입력 (서비스도메인을 입력)

ex) >imsi.service.com

 

 

 

 

 

- 5)에서 만든 디렉토리 경로 입력

> /etc/awstats

 

 

 

-완료

 

 

 

8) 설정파일 변경

vi /etc/awstats/awstats.도메인.conf

 

ex) vi /etc/awstats/awstats.imsi.service.com.conf

awstats.도메인.conf 화면

 

 

9)conf 파일 설정 변경

-apache서버의 access_log파일의 경로 설정(서버마다 다를 수 있기 때문에 꼭 확인)

LogFile="/usr/local/apache/logs/access_log"

 

-LogFormat 확인

LogFormat=1

 

-SiteDomain 확인(서비스도메인)

SiteDomain="imsi.service.com"

 

-HostAliases 확인

HostAliases="imsi.service.com www.imsi.service.com 127.0.0.1 localhost"

 

-DirData 확인

DirData=”/var/lib/awstats”

 

- Lang 설정(한글)

Lang=”ko”

 

-저장

:wq

 

 

10) 아파치 httpd.conf 설정

vi /httpd.conf 경로

 

-로그파일의 형식을 설정(**실제 access_log위치를 써주세요)

CustomLog /usr/local/apache/logs/access_log combined

 

- AddHandler 확인(없을경우 기존 AddHandler에 추가하지말고 새로 입력)

AddHandler cgi-script .cgi .pl

 

-virtualhost설정 (여기서 서버네임은 새로운 도메인(or 새로운 서브도메인)을 사용)

<VirtualHost xxx.xxx.xxx.xxx>

DocumentRoot /usr/local/awstats/wwwroot

ServerName state.xxxx.com

</VirtualHost>

 

 

 

11)아파치 서버 재실행

service httpd restart

 

 

 

12)사이트 접속

http://”새로운 서브도메인”/awstats/awstats.pl?config=”서비스도메인”

 

 

 

-----------------------------------크론탭 설정(자동 통계 업데이트)

awstate는 명령어로 업데이트를 해줘야 데이터가 최신으로 반영이 되기 때문에, 크론으로 자동업데이트를 걸어둠 

 

crontab -e

 

//아래 설정 후 저장(새벽 2시마다 업데이트)

00 2 * * * /usr/local/awstats/wwwroot/cgi-bin/awststs.pl -update -config=aw

 

//크론 재시작

/etc/rc.d/init.d/crond restart

 

 

 

-----------------------------------사이트 접속에 500에러 발생

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

 

Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

 

More information about this error may be available in the server error log.

 

**아파치 에러로그를 확인해보라는 내용임

 

 

아파치 로그 확인

tail -2 /var/log/httpd/error_log

 

에러내용이

Permission denied: exec of '/usr/local/awstats/wwwroot/cgi-bin/awstats.pl' failed 일 경우

 

-권한설정

chmod 755 /usr/bin/perl

 

 

 

댓글

Designed by JB FACTORY