awstate 설치(자세히/오류해결포함) 및 권한설정-아파치 로그 웹통계 툴
- 프로그래밍/개발새발
- 2019. 9. 25.
1)파일 다운로드
- http://awstats.sourceforge.net ≪다운로드 파일은 이 사이트에서 최신버전확인
-받는 위치는 /root경로
-아래는 다운로드 명령어
wget http://prdownloads.sourceforge.net/awstats/awstats-7.7.tar.gz
2)압축풀기
tar xvfz awstats-7.7.tar.gz
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
//httpd.conf 경로를 입력
ex) >/xxx/xxx/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
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
'프로그래밍 > 개발새발' 카테고리의 다른 글
awstate -로그인 보안인증 (0) | 2019.09.27 |
---|---|
goaccess설치 및 사용방법 오류 해결 - 아파치 로그 웹통계 툴 (0) | 2019.09.26 |
객체지향 5원칙 : 5.의존성 역전의 원칙 , 의존성 주입이란 무엇인가.. (1) | 2019.09.09 |
객체지향 5원칙 : 4.인터페이스 분리의 원칙, 예시를 보며 이해하는 과정.. (0) | 2019.07.03 |
객체지향 5원칙 : 3.리스코브 치환의 원칙, 적용방법!쉬운 예시! (0) | 2019.06.25 |