mirror of
https://github.com/bunkerity/bunkerized-nginx
synced 2023-12-13 21:30:18 +01:00
20 lines
540 B
Plaintext
20 lines
540 B
Plaintext
geoip2 /etc/nginx/geoip.mmdb {
|
|
auto_reload 5m;
|
|
$geoip2_metadata_country_build metadata build_epoch;
|
|
$geoip2_data_country_code country iso_code;
|
|
}
|
|
|
|
map $geoip2_data_country_code $allowed_country {
|
|
default {% if WHITELIST_COUNTRY != "" %}no{% else %}yes{% endif +%};
|
|
{% if WHITELIST_COUNTRY != "" %}
|
|
{% for country in WHITELIST_COUNTRY.split(" ") +%}
|
|
{{ country }} yes;
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% if BLACKLIST_COUNTRY != "" %}
|
|
{% for country in BLACKLIST_COUNTRY.split(" ") +%}
|
|
{{ country }} no;
|
|
{% endfor %}
|
|
{% endif %}
|
|
}
|