Fedora : mod_geoip For Apache2
The guide explains how to set up mod_geoip with Apache2 on a Fedora 9. mod_geoip looks up at the client IP address end-user. This allows you to redirect or prevent users based on their country. You can also use this technology for your Openx (formerly known as OpenAds or phpAdsNew) ad server to allow geographical targeting.
I'm not issue any guarantee that it works for you!
1 Preliminary Note
2 Installing mod_geoip
mv GeoIP.dat GeoIP.dat_orig
wget http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz
gunzip GeoIP.dat.gz
3 A Short Test
print_r($_SERVER);
?>
(
[GEOIP_CONTINENT_CODE] => EU
[GEOIP_COUNTRY_CODE] => DE
[GEOIP_COUNTRY_NAME] => Germany
[HTTP_HOST] => 84.143.142.69
[HTTP_USER_AGENT] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
[HTTP_ACCEPT] => text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
[HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5
[HTTP_ACCEPT_ENCODING] => gzip,deflate
[HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
[HTTP_KEEP_ALIVE] => 300
[HTTP_CONNECTION] => keep-alive
[PATH] => /sbin:/usr/sbin:/bin:/usr/bin
[SERVER_SIGNATURE] => <address>Apache/2.2.8 (Fedora) Server at 84.143.142.69 Port 80</address>
[SERVER_SOFTWARE] => Apache/2.2.8 (Fedora)
[SERVER_NAME] => 84.143.142.69
[SERVER_ADDR] => 192.168.0.100
[SERVER_PORT] => 80
[REMOTE_ADDR] => 84.143.142.69
[DOCUMENT_ROOT] => /var/www/html
[SERVER_ADMIN] => root@localhost
[SCRIPT_FILENAME] => /var/www/html/geoiptest.php
[REMOTE_PORT] => 57421
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /geoiptest.php
[SCRIPT_NAME] => /geoiptest.php
[PHP_SELF] => /geoiptest.php
[REQUEST_TIME] => 1211819286
)
4 Use Cases
5 Links
0 comments:
Post a Comment