Skip to content

admobitec/ngx-ip2location

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nginx IP2Location Module
========================

This is a IP2Location Nginx Module that enables the user to identify the country, region, city, latitude, longitude, zip code, time zone, ISP, domain name, connection type, area code and weather by IP address.

Requirements
------------
1.

1. IP2Location C API library ( download from http://www.ip2location.com/developers/c.aspx )

2. Nginx (version > 0.5)

Installation
------------
1. Install dependencies:

# These are for RedHat, CentOS, and Fedora.
$ sudo yum install gcc-c++ pcre-dev pcre-devel zlib-devel make libtool

# These are for Debian. Ubuntu will be similar.
$ sudo apt-get install build-essential zlib1g-dev libpcre3 libpcre3-dev libtool

2. Download & Install IP2Location

$ wget http://www.ip2location.com/downloads/ip2location-c-7.0.0.tar.gz
$ tar xvfz ip2location-c-7.0.0.tar.gz
$ cd ip2location-c-7.0.0
$ ./configure
$ make
$ sudo make install

3. Download & Install Nginx & ngx-ip2location

$ wget http://nginx.org/download/nginx-VERSION.tar.gz 
$ tar -xvzf nginx-VERSION.tar.gz 
$ cd nginx-VERSION
$ ./configure --add-module=/path/to/ngx-ip2location
$ make
$ sudo make install

Module Configuration
--------------------

Syntax:  ip2location on|off
Default: off
Context: http, server, location
Description: enable or disable ip2location

Syntax:  ip2location_database path
Default: none
Context: http
Description: specifies the ip2location bin file

Syntax:  ip2location_access_type file_io|shared_memory|cache_memory
Default: shared_memory
Context: http
Description: specifies to where the iplocation DB file will be loaded.

Syntax:  ip2location_proxy cidr|address
Default: none
Context: http
Description: sets a list of proxies to translate x-forwarded-for headers for

Syntax:  ip2location_proxy_recursive on|off
Default: off
Context: http
Description: enables recursive search in the x-forwarded-for address list


Variables
---------
ip2location_country_short
ip2location_country_long
ip2location_region
ip2location_city
ip2location_isp
ip2location_latitude
ip2location_longitude
ip2location_domain
ip2location_zipcode
ip2location_timezone
ip2location_netspeed
ip2location_iddcode
ip2location_areacode
ip2location_weatherstationcode
ip2location_weatherstationname
ip2location_mcc
ip2location_mnc
ip2location_elevation
ip2location_usagetype

Config Example
--------------
nginx.conf.example


Releases

No releases published

Packages

No packages published

Languages

  • C 94.6%
  • PHP 5.4%