<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>RedHatVN Network &#187; mod_geoip</title>
	<atom:link href="http://redhatvn.net/tag/mod_geoip/feed" rel="self" type="application/rss+xml" />
	<link>http://redhatvn.net</link>
	<description>Shared Linux problems</description>
	<lastBuildDate>Mon, 31 Oct 2011 07:10:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Installing mod_geoip For Apache2 On Fedora 9</title>
		<link>http://redhatvn.net/installing-mod_geoip-for-apache2-on-fedora-9</link>
		<comments>http://redhatvn.net/installing-mod_geoip-for-apache2-on-fedora-9#comments</comments>
		<pubDate>Thu, 27 Aug 2009 04:46:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[mod_geoip]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=244</guid>
		<description><![CDATA[This guide explains how to set up mod_geoip with Apache2 on a Fedora 9 system. mod_geoip looks up the IP address of the client end user. This allows you to redirect or block users based on their country. You can also use this technology for your OpenX (formerly known as OpenAds or phpAdsNew) ad server [...]]]></description>
			<content:encoded><![CDATA[<div class="google_plus_one"><g:plusone size="medium" count="true" url="http://redhatvn.net/installing-mod_geoip-for-apache2-on-fedora-9"></g:plusone></div><p>This guide explains how to set up mod_geoip with Apache2 on a Fedora 9 system. mod_geoip looks up the IP address of the client end user. This allows you to redirect or block users based on their country. You can also use this technology for your OpenX (formerly known as OpenAds or phpAdsNew) ad server to allow geo targeting.</p>
<p>I do not issue any guarantee that this will work for you!</p>
<p><span id="more-244"></span></p>
<h3>1 Preliminary Note</h3>
<p>I&#8217;m assuming that you have a running Fedora 9 system with a working Apache2 + PHP, e.g.</p>
<h3>2 Installing mod_geoip</h3>
<p>To install mod_geoip, we simply run:</p>
<p>yum install mod_geoip</p>
<p>You will then find the GeoIP database (<span>GeoIP.dat</span>) in the <span>/usr/share/GeoIP</span> directory. As the geographic allocation of IP addresses can change over time, it&#8217;s a good idea to download the newest <span>GeoIP.dat</span> now:</p>
<p>cd /usr/share/GeoIP/<br />
mv GeoIP.dat GeoIP.dat_orig<br />
wget http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz<br />
gunzip GeoIP.dat.gz</p>
<p>Next we restart Apache:</p>
<p>/etc/init.d/httpd restart</p>
<p>That&#8217;s it already!</p>
<h3>3 A Short Test</h3>
<p>To see if mod_geoip is working correctly, we can create a small PHP file in one of our web spaces (e.g. <span>/var/www/html</span>):</p>
<p>vi /var/www/html/geoiptest.php</p>
<blockquote><p>&lt;?php<br />
print_r($_SERVER);<br />
?&gt;</p>
<p>&#8212;</p>
<p>Call that file in a browser, and it should display the <span>SERVER</span> array including values for <span>GEOIP_COUNTRY_CODE</span>, <span>GEOIP_CONTINENT_CODE</span>, and <span>GEOIP_COUNTRY_NAME</span> <span>(make sure that you&#8217;re calling the file from a public IP address, not a local one)</span>.</p>
<p>Array<br />
 (<br />
 <span>[GEOIP_CONTINENT_CODE] =&gt; EU</span><br />
 <span>[GEOIP_COUNTRY_CODE] =&gt; DE</span><br />
 <span>[GEOIP_COUNTRY_NAME] =&gt; Germany</span><br />
 [HTTP_HOST] =&gt; 84.143.142.69<br />
 [HTTP_USER_AGENT] =&gt; Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14<br />
 [HTTP_ACCEPT] =&gt; text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5<br />
 [HTTP_ACCEPT_LANGUAGE] =&gt; en-us,en;q=0.5<br />
 [HTTP_ACCEPT_ENCODING] =&gt; gzip,deflate<br />
 [HTTP_ACCEPT_CHARSET] =&gt; ISO-8859-1,utf-8;q=0.7,*;q=0.7<br />
 [HTTP_KEEP_ALIVE] =&gt; 300<br />
 [HTTP_CONNECTION] =&gt; keep-alive<br />
 [PATH] =&gt; /sbin:/usr/sbin:/bin:/usr/bin<br />
 [SERVER_SIGNATURE] =&gt; &lt;address&gt;Apache/2.2.8 (Fedora) Server at 84.143.142.69 Port 80&lt;/address&gt;</p>
<p> [SERVER_SOFTWARE] =&gt; Apache/2.2.8 (Fedora)<br />
 [SERVER_NAME] =&gt; 84.143.142.69<br />
 [SERVER_ADDR] =&gt; 192.168.0.100<br />
 [SERVER_PORT] =&gt; 80<br />
 [REMOTE_ADDR] =&gt; 84.143.142.69<br />
 [DOCUMENT_ROOT] =&gt; /var/www/html<br />
 [SERVER_ADMIN] =&gt; root@localhost<br />
 [SCRIPT_FILENAME] =&gt; /var/www/html/geoiptest.php<br />
 [REMOTE_PORT] =&gt; 57421<br />
 [GATEWAY_INTERFACE] =&gt; CGI/1.1<br />
 [SERVER_PROTOCOL] =&gt; HTTP/1.1<br />
 [REQUEST_METHOD] =&gt; GET<br />
 [QUERY_STRING] =&gt;<br />
 [REQUEST_URI] =&gt; /geoiptest.php<br />
 [SCRIPT_NAME] =&gt; /geoiptest.php<br />
 [PHP_SELF] =&gt; /geoiptest.php<br />
 [REQUEST_TIME] =&gt; 1211819286<br />
 )
</p></blockquote>
<h3>4 Use Cases</h3>
<p>You can use mod_geoip to redirect or block/allow users based on their country. You can find some useful examples for this here: <a href="http://www.maxmind.com/app/mod_geoip" target="_blank">http://www.maxmind.com/app/mod_geoip</a></p>
<h3>5 Links</h3>
<ul>
<li>mod_geoip: <a href="http://www.maxmind.com/app/mod_geoip" target="_blank">http://www.maxmind.com/app/mod_geoip</a></li>
<li>Apache: <a href="http://httpd.apache.org/" target="_blank">http://httpd.apache.org</a></li>
<li>Fedora: <a href="http://fedoraproject.org/" target="_blank">http://fedoraproject.org</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/installing-mod_geoip-for-apache2-on-fedora-9/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
