Fix nginx first run without maxmind db

This commit is contained in:
Albert Armea 2026-03-21 20:10:27 +00:00
parent 76effee03f
commit 6e6c958588

View file

@ -26,13 +26,15 @@ http {
keepalive_timeout 65;
# ── GeoIP2 database ───────────────────────────────────────────────────────
# The GeoLite2-City database gives us country + subdivision (state/province)
# on_unavailable lets nginx start even if the .mmdb file doesn't exist yet
# (e.g. first boot before geoipupdate has run). All GeoIP variables default
# to their `default=` values in that case no requests will be blocked
# (fail-open). auto_reload picks up a refreshed DB from geoipupdate without
# requiring an nginx restart.
geoip2 /usr/share/GeoIP/GeoLite2-City.mmdb {
# ISO 3166-1 alpha-2 country code (e.g. "US")
$geoip2_country country iso_code;
# ISO 3166-2 subdivision code country prefix stripped below
# Full value looks like "US-CA"; we expose just the subdivision part
$geoip2_subdivision subdivisions 0 iso_code;
auto_reload 1h;
$geoip2_country default=XX country iso_code;
$geoip2_subdivision default="" subdivisions 0 iso_code;
}
# Compound key used in per-repo map blocks: "CC-SUBDIV" e.g. "US-CA"