a lua client to get ip location maxminddb


#a lua client for maxmind db ###to get ip location with ip database offerd by maxmind

##Installation 1: install libmaxminddb from this repo

2: download ip database from maxmind

###demo code:

    local maxminddb     =       require("resty.maxminddb")
    local geo_file              =       '/home/lua/common_data/GeoIP2-Country-20161004.mmdb'
    local ipDB                  = 
    local ip    =       ngx.req.get_uri_args()['ip']
    local out   =       {}
    if not ip then
        return nil
    local res,err               =       ipDB:get_area_code(ip)
    ngx.print( res )

Bug Reports

Please report bugs by filing an issue with our GitHub issue tracker at or if the bug is casued by libmaxminddb tracker at

Copyright and License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.