336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

[웹서버] GeoIP 설치하기

AWStats와 GeoIP를 연동하여 방문자 통계를 국가별로 확인할 수 있습니다.


# GeoIP 설치

1. 디렉터리를 만듭니다.
mkdir -p /usr/local/share/GeoIP



2. GeoIP를 다운로드 합니다.
cd /usr/local/share/GeoIP/
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz



3. 다운로드 한 GeoIP 파일의 압축을 해제합니다.
gzip -d GeoIP.dat.gz
gzip -d GeoLiteCity.dat.gz



4. awstats 파일을 수정하여 GeoIP 플러그인과 연동합니다.

vi /etc/awstats/awstats.www.xxx.com.conf

1320, 1321 라인을 다음과 같이 수정합니다.
LoadPlugin="geoip GEOIP_STANDARD /usr/local/share/GeoIP/GeoIP.dat"
LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /usr/local/share/GeoIP/GeoLiteCity.dat"





5. awstats 파일을 업데이트 합니다.
/usr/local/awstats/tools/awstats_updateall.pl now


6. MaxMind에서 PurePerl Module을 다운로드 합니다.
wget http://geolite.maxmind.com/download/geoip/api/perl/Geo-IP-1.38.tar.gz


7. 해당 파일을 컴파일 합니다.
tar xvfz Geo-IP-1.38.tar.gz
cd Geo-IP-1.38
perl Makefile.PL


# perl Makefile.PL 시 다음과 같은 에러가 발생될 수 있습니다.
 Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .) at Makefile.PL line 1.
BEGIN failed--compilation aborted at Makefile.PL line 1.

-> 해결방안
yum install perl-ExtUtils-MakeMaker
또는 yum install perl*로 해당 파일을 업데이트



8. 해당 파일을 계속 컴파일 합니다...
make ; make test
make install


9. awstat 파일을 업데이트하면 작업이 완료되어 국가가 표시되는 것을 확인할 수 있습니다.
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.xxx.com

 




+ Recent posts