wget
http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gztar xvfz
./configure
make
make install
mod_geoip
http://geolite.maxmind.com/download/geoip/api/mod_geoip/mod_geoip_1.3.4.tar.gz
http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz데이타 파일
GeoIPEnable On
GeoIPDBFile /path/to/GeoIP.dat
# Redirect one country
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^CA$
RewriteRule ^(.*)$
http://www.canada.com$1 [L]
# Redirect multiple countries to a single page
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(CA|US|MX)$
RewriteRule ^(.*)$
http://www.northamerica.com$1 [L]
GeoIPEnable On
GeoIPDBFile /var/geoip
SetEnvIf GEOIP_COUNTRY_CODE CN BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE RU BlockCountry
# ... place more countries here
Deny from env=BlockCountry
# Optional - use if you want to allow a specific IP address from the country you denied
# (See
http://httpd.apache.org/docs/1.3/mod/mod_access.html for more details)
Allow from 10.1.2.3
./configure "--with-layout=Apache" \
"--activate-module=src/modules/php4/libphp4.a" \
"--enable-module=rewrite" "--add-module=../mod_redurl.c" \
"--activate-module=src/modules/extra/mod_geoip.c"
/usr/local/apache/bin/httpd -l
Compiled-in modules:
http_core.c
mod_env.c
mod_log_config.c
mod_mime.c
mod_negotiation.c
mod_status.c
mod_include.c
mod_autoindex.c
mod_dir.c
mod_cgi.c
mod_asis.c
mod_imap.c
mod_actions.c
mod_userdir.c
mod_alias.c
mod_rewrite.c
mod_access.c
mod_auth.c
mod_setenvif.c
mod_php4.c
mod_redurl.c
mod_geoip.c
================================================
# 한국만 가능
<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /var/geoip/GeoIP.dat
SetEnvIf GEOIP_COUNTRY_CODE CN BlockCountry
SetEnvIf GEOIP_COUNTRY_CODE RU BlockCountry
<Directory />
Order Allow,Deny
Allow from all
Deny from env=BlockCountry
</Directory>
</IfModule>
=========================================