Showing posts with label Fedora. Show all posts
Showing posts with label Fedora. Show all posts

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

I'm assuming that you have a running Fedora 9 system with a working Apache2 + PHP

2 Installing mod_geoip
To install mod_geoip, we simply run:

yum install mod_geoip

You will then find the GeoIP database (GeoIP.dat) in the /usr/share/GeoIP directory. As the geographic allocation of IP addresses can change over time, it's a good idea to download the newest GeoIP.dat now:

cd /usr/share/GeoIP/

mv GeoIP.dat GeoIP.dat_orig

wget http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz

gunzip GeoIP.dat.gz

Next we restart Apache:

/etc/init.d/httpd restart

That's it already!

3 A Short Test
To see if mod_geoip is working correctly, we can create a small PHP file in one of our web spaces (e.g. /var/www/html):

vi /var/www/html/geoiptest.php

<?php
print_r($_SERVER);
?>

Call that file in a browser, and it should display the SERVER array including values for GEOIP_COUNTRY_CODE, GEOIP_CONTINENT_CODE, and GEOIP_COUNTRY_NAME (make sure that you're calling the file from a public IP address, not a local one).

Array

(

[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

)

If you want to use Apache2 + mod_geoip for your OpenX ad server, make sure you select MaxMind mod_apache GeoIP under Settings > Main Settings > Geotargeting Settings:

4 Use Cases
You can use mod_geoip to redirect or block/allow users based on their country. You can find some useful examples for this here: http://www.maxmind.com/app/mod_geoip


5 Links


Read more...

Trick: Fedora 9 "Sulphur" - The Perfect Server

It is a detailed description on how to set up a server Fedora 9, which offers all services needed by ISPs and hosters: Apache web server (SSL compatible) with PHP5 and Ruby, server Postfix mail with SMTP AUTH and TLS, BIND DNS server, Proftpd FTP server, MySQL, dovecote POP3/IMAP, Quota, Firewall, etc. This tutorial is written for 32-bit version of Fedora 9, but should apply to 64-bit version with very few changes.

I'll use the following software:

* Web Server: Apache 2.2.8
* PHP 5.2.5
* Ruby
* Server database: MySQL 5.0.51
* Mail Server: Postfix
* DNS: BIND9 (chroot)
* FTP server: proftpd
* POP3/IMAP server: dovecote
* Webalizer statistics for website

In the end, you should have a system that works reliably, and if you want, you can install free control panel hosting ISPConfig (ie, ISPConfig runs on it out of the box).

Read more at Howtoforge.com


Read more...

Fedora 9 code name "sulphur" released

There is still time for a major new version of Fedora Linux. The latest avatar of Fedora namely version 9 is the code name of sulphur. If you are bitten by the strange name of Fedora, then you should read this article to get a better perspective. So what is in store for all fans of Fedora? A number of things.

To begin with, Fedora has obtained what is known as PackageKit. It is a cross distribution management solution packages with a complete backend Yum. Then, Fedora comes with the latest and greatest version Gnome Desktop namely 2.22. KDE 4.0.3 is also the repository and can be installed on the hard core fans of KDE. But the biggest news is that Fedora is now shipped with the Sun Java that Sun has released Java under an open source license. For the full set of features, read this article that explains all the features in more detail.

And after reading the features, if you're quite excited (which you will be), then visit the download page and start your download Linux distribution Fedora alias 9 sulphur.


Read more...