Giter Club home page Giter Club logo

pahla1 / ip2location-nginx Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ip2location/ip2location-nginx

0.0 0.0 0.0 19 KB

This is IP2Location Nginx module that enables the user to find the country, region (state), city, latitude, longitude, zip code, time zone, ISP, domain name, connection type, area code, weather, mobile network, elevation, and usage type by IP address or hostname originates from.

Home Page: http://www.ip2location.com

License: MIT License

C 100.00%

ip2location-nginx's Introduction

Nginx IP2Location module

Description:

The Nginx IP2Location module enables user to easily perform client's IP to geographical location lookup by using IP2Location database.

The IP2Location database can be downloaded from https://lite.ip2location.com (Free) or https://www.ip2location.com (Commercial).

Installation:

  1. Download IP2location C library from https://www.ip2location.com/developers/c

  2. Change the path to IP2Location library in "ngx_http_ip2location_module.c".

  3. Re-compile Nginx from source to include this module. Add the below directive into the compile of Nginx:

    ./configure --add-module=/absolute/path/to/nginx-ip2location-VERSION
    make
    make install
    

    or

    ./configure --add-dynamic-module=/absolute/path/to/nginx-ip2location-VERSION
    make
    make install
    

Nginx Configuration

Insert the configuration below to your nginx.conf.

Syntax:  load_module modules/ngx_http_ip2location_module.so;
Default: -
Context: main
Description: Load IP2Location Nginx module if it was compiled as dynamic.
Syntax:  ip2location on|off
Default: off
Context: http, server, location
Description: Enable or disable IP2Location Nginx module.
Syntax:  ip2location_database path
Default: none
Context: http
Description: The absolute path to IP2Location BIN database.
Syntax:  ip2location_access_type file_io|shared_memory|cache_memory
Default: shared_memory
Context: http
Description: Set the method used for lookup.
Syntax:  ip2location_proxy cidr|address
Default: none
Context: http
Description: Set a list of proxies to translate x-forwarded-for headers for.
Syntax:  ip2location_proxy_recursive on|off
Default: off
Context: http
Description: Enable recursive search in the x-forwarded-for headers.

Variables

The following variables will be made available in Nginx:

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

IPv4 BIN vs IPv6 BIN

Use the IPv4 BIN file if you just need to query IPv4 addresses. If you query an IPv6 address using the IPv4 BIN, you'll see the IPV6_NOT_SUPPORTED error.

Use the IPv6 BIN file if you need to query BOTH IPv4 and IPv6 addresses.

Support

Please visit us at https://www.ip2location.com for services and databases we offer.

For support, please email us at [email protected]

ip2location-nginx's People

Contributors

ip2location avatar morganov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.