Member-only story

Identifying a country or city from an IP address in NGINX

Maciej
26 min readJun 16, 2021

--

Photo by S Migaj on Unsplash

Introduction

In this post, I will cover the topic of Identifying a Country or City by IP Address on an NGINX Server. GeoLite2 this a DB has been created by MaxMind to identify countries and cities by IP address. There is a commercial version of GeoIP2 and an open source version of GeoLite2 , however, to be able to download this database, we must create an account at https://www.maxmind.com/

Environment

Let’s start

  • Install libmaxminddb
root@vagrant:/home/vagrant# add-apt-repository ppa:maxmind/ppaMore info: https://launchpad.net/~maxmind/+archive/ubuntu/ppa
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keyring `/tmp/tmpsm2acf17/secring.gpg' created
gpg: keyring `/tmp/tmpsm2acf17/pubring.gpg' created
gpg: requesting key DE742AFA from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpsm2acf17/trustdb.gpg: trustdb created
gpg: key DE742AFA: public key "Launchpad PPA for MaxMind" imported
gpg: Total number processed: 1
gpg: imported: 1…

--

--

Maciej
Maciej

Written by Maciej

DevOps Consultant. I’m strongly focused on automation, security, and reliability.

No responses yet