Wednesday, March 5, 2014


PIWIK region and city install

Steps to  install region and city location:
1. Install the Visual C++ 2008 SP1 Redistributable Package
    Download, if you have not done so already, from the
    address above.

2. Download either the GeoIPCountry Lite or GeoIPCity Lite database from Maxmind
    or use the included GeoIPCountry Lite database. 
    Untar the file and place in Apache's /bin folder
    C:/Apache22/bin/geoip.dat for example using GeoIPCountry Lite

3. Copy mod_geoip.so to your Apache 2.2.x modules folder
    C:/Apache22/modules/mod_geoip.so for example

4. Load mod_geoip.so into your Apache 2.2.x by adding the below line to your httpd.conf file
    LoadModule geoip_module modules/mod_geoip.so

5. Add the sample configuration below at the bottom of your httpd.conf file
<IfModule geoip_module>
                GeoIPEnable On
                GeoIPScanProxyHeaders On
                GeoIPEnableUTF8 On
                #GeoIPUseFirstXForwardedForIP
  # Specify full path to the database here!
  # Use only one database.
  # GeoIPDBFile /path/to/GeoIP.dat
  # GeoIPDBFile /path/to/GeoLiteCity.dat

  # IPv6 support use two databases
  GeoIPDBFile bin/GeoIPv6.dat
  #GeoIPDBFile bin/GeoIP.dat
  GeoIPDBFile bin/GeoIPCity.dat

</IfModule>


6. D:\Apache Software Foundation\Apache2.2\htdocs\piwik\misc\others>php ./geoipUpdateRows.php


Source:

Date: June 27, 2013
Application:
mod_geoip2 1.2.8a
Distribution File:
mod_geoip-1.2.8a-2.2.x-x86.zip
Original source by:
MaxMind, Inc.
Original Home:


Win32 binary by:
Gregg at The Apache Haus
Mail:
Home:


** This build for Apache 2.2.x only! **
Supported Windows Versions:


Windows XP SP3
(IPv4 only)
Windows Server 2003
(IPv4 only)
Windows Vista
(IPv4 & IPv6)
Windows 7
(IPv4 & IPv6)
Windows Server 2008
(IPv4 & IPv6)
Windows 8
(IPv4 & IPv6)
Windows Server 2012
(IPv4 & IPv6)

Package Contents:

readme_first.html [this file]
/Apache22/modules/mod_geoip.so
/geoipdata/GeoIP.dat
/geoipdata/GeoIPv6.dat
README
Changes

NOTES:

Built with Visual Studio 2008 SP1, be sure to install the Visual C++ 2008 SP1 Redistributable Package
it can be downloaded from;

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2

INTRODUCTION

mod_geoip2 is a module for Apache 2.4 that will determine country, state/region, city, US postal code, US area code, metro code, latitude, and longitude information for IP addresses worldwide.
You can use the included database (GeoIP.dat) however this wll most likely be outdated. 
The database is updated monthly at maxmind.com.
http://www.maxmind.com/download/geoip/database/

mod_geoip2 outputs these environment variable using the supplied GeoLite Country (GeoIP.dat) database:
IPv4
  • GEOIP_COUNTRY_CODE
  • GEOIP_COUNTRY_NAME
IPv6
  • GEOIP_COUNTRY_CODE_V6
  • GEOIP_COUNTRY_NAME_V6

mod_geoip outputs these environment variable using the available GeoLite City (GeoLiteCity.dat) database from maxmind.com:
IPv4
  • GEOIP_AREA_CODE
  • GEOIP_CITY
  • GEOIP_COUNTRY_CODE
  • GEOIP_COUNTRY_CODE3
  • GEOIP_COUNTRY_NAME
  • GEOIP_DMA_CODE
  • GEOIP_LATITUDE
  • GEOIP_LONGITUDE
  • GEOIP_REGION
IPv6
  • GEOIP_AREA_CODE_V6
  • GEOIP_CITY_V6
  • GEOIP_COUNTRY_CODE_V6
  • GEOIP_COUNTRY_CODE3_V6
  • GEOIP_COUNTRY_NAME_V6
  • GEOIP_DMA_CODE_V6
  • GEOIP_LATITUDE_V6
  • GEOIP_LONGITUDE_V6
  • GEOIP_REGION_V6

If this is your first install of mod_bw:

To install this module on your Apache 2.2.x server you need to copy the necessary files to your Apache folder and add items to your Apache's httpd.conf file. C:\Apache22 will be used as our ServerRoot for the examples below.
1. Install the Visual C++ 2008 SP1 Redistributable Package
    Download, if you have not done so already, from the
    address above.

2. Download either the GeoIPCountry Lite or GeoIPCity Lite database from Maxmind
    or use the included GeoIPCountry Lite database. 
    Untar the file and place in Apache's /bin folder
    C:/Apache22/bin/geoip.dat for example using GeoIPCountry Lite

3. Copy mod_geoip.so to your Apache 2.2.x modules folder
    C:/Apache22/modules/mod_geoip.so for example

4. Load mod_geoip.so into your Apache 2.2.x by adding the below line to your httpd.conf file
    LoadModule geoip_module modules/mod_geoip.so

5. Add the sample configuration below at the bottom of your httpd.conf file

Sample Configuration:
<IfModule geoip_module>
               GeoIPEnable On
  # Specify full path to the database here!
  # Use only one database.
  # GeoIPDBFile /path/to/GeoIP.dat
  # GeoIPDBFile /path/to/GeoLiteCity.dat
 
  # IPv6 support use two databases
  GeoIPDBFile bin/GeoIPv6.dat
  GeoIPDBFile bin/GeoLiteCity.dat
</IfModule>
For more examples the see the README file
Directives Quick Reference
GeoIPDBFile: Path to GeoIP Data File
GeoIPEnable: Turn on mod_geoip
GeoIPEnableUTF8: Turn on utf8 characters for city names
GeoIPOutput: Specify output method(s)
GeoIPScanProxyHeaders: Get IP from HTTP_CLIENT IP or X-Forwarded-For
GeoIPToken: Turn off/on mod_geoip token in server signature, default: Off
GeoIPUseFirstNonPrivateXForwardedForIP: For more IP's in X-Forwarded-For, use the first non private IP
GeoIPUseFirstXForwardedForIP: For more IP's in X-Forwarded-For, use the first
GeoIPUseLastXForwardedForIP:  For more IP's in X-Forwarded-For, use the last
 

TEST MODULE

The easiest way to test this module on your Apache 2.2.x server is to goto a phpinfo() page and look at the PHP Variables. like:
    http://www.example.com/phpinfo.php

You should see some or all of the below varables de[ending on which database you chose. Note: You cannot usehttp://localhost to test.

_SERVER["GEOIP_ADDR"]           208.206.108.6
_SERVER["GEOIP_CONTINENT_CODE"] NA
_SERVER["GEOIP_COUNTRY_CODE"]   US
_SERVER["GEOIP_COUNTRY_NAME"]   United States
_SERVER["GEOIP_REGION"]         CA
_SERVER["GEOIP_REGION_NAME"]    California
_SERVER["GEOIP_CITY"]           Vista
_SERVER["GEOIP_DMA_CODE"]       825
_SERVER["GEOIP_AREA_CODE"]      760
_SERVER["GEOIP_LATITUDE"]       33.200699
_SERVER["GEOIP_LONGITUDE"]      -117.225502
mod_geoip2/1.2.8a



Source: