apache geoip2 설치
o/s : centos 6.5 64bit
apache : 2.2
wget mirror.koreaidc.com/geoip/geoip-api-mod_geoip2-1.2.9.tar.gz
tar xvfz geoip-api-mod_geoip2-1.2.9.tar.gz
cd geoip-api-mod_geoip2-1.2.9
/usr/local/apache/bin/apxs -i -a -L/usr/local/include -I/usr/local/lib -lGeoIP -c mod_geoip.c
mkdir /var/geoip
최신파일 다운로드
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
wget http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz
gunzip GeoIP.dat.gz
gunzip GeoLiteCity.dat.gz
gunzip GeoIPASNum.dat.gz
vi /usr/local/apache/conf/httpd.conf
<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /var/geoip/GeoIP.dat
GeoIPDBFile /var/geoip/GeoLiteCity.dat
GeoIPDBFile /var/geoip/GeoIPASNum.dat
</IfModule>
아파치 logformat 변경
LogFormat “%V [%h] %u %t %D \”%r\” %>s %b \”%{Referer}i\” \”%{User-Agent}i\” GeoIP_Address=\”%{GEOIP_ADDR}e\” Country_Code=\”%{GEO
IP_COUNTRY_CODE}e\” Country_Name=\”%{GEOIP_COUNTRY_NAME}e\”” vcommon
xinet.kr [112.216.164.44] – [19/Nov/2014:11:36:26 +0900] 15905 “GET /planet.jpg HTTP/1.1” 200 27662 “-” “Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36″ GeoIP_Address=”112.216.164.44″ Country_Code=”KR” Country_Name=”Korea, Republic of”