Japanatron Logo

geoip

  • Nginx - How to Block or Redirect by GeoIP

    I've been figuring out how to block or redirect web traffic in Nginx based on the country geoIP.

    NOTES
    * You need the package nginx-extras for this because this package has the geoIP Nginx plugin.
    * I used Japan (JP) in these examples, so change the country code to whatever you wish.

    APPROACH #1 - BASIC
    This uses a locally-downloaded GeoIP database.