Created
January 15, 2019 23:06
-
-
Save SushiFu/4fc428b72b2ecc02bf5f4b20d15b43a3 to your computer and use it in GitHub Desktop.
Use MaxMind GeoLite2 Country w/ nginx Docker image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:latest as geoip | |
RUN git clone https://github.com/makhomed/nginx-geo.git nginx-geo && \ | |
nginx-geo/nginx-geo --download --convert --work-dir / | |
FROM nginx:stable | |
COPY ./config /etc/nginx | |
COPY --from=geoip /geoip_country_code.conf /etc/nginx/geoip/geoip_country_code.conf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## [...] | |
http { | |
## [...] | |
geo $geoip_country_code { | |
proxy_recursive; | |
default US; | |
include /etc/nginx/geoip/geoip_country_code.conf; | |
} | |
## $geoip_country_code variable is available w/ 'US' fallback value | |
} | |
# daemon off; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment