Giter VIP home page Giter VIP logo

mods's Introduction

Maxmind Docker mod for Nginx based images

This mod adds the maxmind database to nginx using the license key defined in the environment variable.

This mod downloads the GeoLite2-City.mmdb database under /config/geoip2db, the database is updated weekly.

This mod should not be enabled together with the swag-dbip mod.

Follow these steps to enable the maxmind mod:

  1. Acquire a maxmind license here: https://www.maxmind.com/en/geolite2/signup

  2. In the container's docker arguments, set an environment variable DOCKER_MODS=linuxserver/mods:swag-maxmind

    If adding multiple mods, enter them in an array separated by |, such as DOCKER_MODS=linuxserver/mods:swag-maxmind|linuxserver/mods:swag-mod2

  3. In the container's docker arguments, set an environment variable MAXMINDDB_LICENSE_KEY=<license-key> with your license key.

  4. Recreate the container to apply the changes.

  5. Add the following line to /config/nginx/nginx.conf under the http section:

    include /config/nginx/maxmind.conf;
  6. Edit /config/nginx/maxmind.conf and add countries to the blocklist / whitelist according to the comments, for example:

    map $geoip2_data_country_iso_code $geo-whitelist {
        default no;
        UK yes;
    }
    
    map $geoip2_data_country_iso_code $geo-blacklist {
        default yes;
        US no;
    }
  7. Use the definitions in the following way:

     server {
         listen 443 ssl;
         listen [::]:443 ssl;
    
         server_name some-app.*;
         include /config/nginx/ssl.conf;
         client_max_body_size 0;
    
         if ($lan-ip = yes) { set $geo-whitelist yes; }
         if ($geo-whitelist = no) { return 404; }
    
         location / {
  8. Restart the container to apply the changes.

mods's People

Contributors

aptalca avatar chbmb avatar drizuid avatar j0nnymoe avatar nemchik avatar roxedus avatar thelamer avatar

Watchers

 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.