Skip to content

Instantly share code, notes, and snippets.

@denji
Last active February 5, 2019 10:38
Show Gist options
  • Save denji/9487759 to your computer and use it in GitHub Desktop.
Save denji/9487759 to your computer and use it in GitHub Desktop.
/usr/local/etc/nginx.conf
# GeoIP
geoip_country /usr/local/share/GeoIP/GeoIP.dat; # the country IP database
geoip_country /usr/local/share/GeoIP/GeoIPv6.dat; # the country IPv6 database
geoip_city /usr/local/share/GeoIP/GeoLiteCity.dat; # the city IP database
geoip_city /usr/local/share/GeoIP/GeoLiteCityv6.dat; # the city IPv6 database
geoip_org /usr/local/share/GeoIP/GeoIPASNum.dat; # the ASN IP database
geoip_org /usr/local/share/GeoIP/GeoIPASNumv6.dat; # the ASN IPv6 database
# GeoLite Country
echo "fetch -o - http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz | gunzip > /usr/local/share/GeoIP/GeoIP.dat" >> /usr/local/bin/geoipupdate.sh
# GeoLite Country IPv6
echo "fetch -o - http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz | gunzip > /usr/local/share/GeoIP/GeoIPv6.dat.gz" >> /usr/local/bin/geoipupdate.sh
# GeoLite City
echo "fetch -o - http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz | gunzip > /usr/local/share/GeoIP/GeoLiteCity.dat" >> /usr/local/bin/geoipupdate.sh
# GeoLite City IPv6 (Beta)
echo "fetch -o - http://geolite.maxmind.com/download/geoip/database/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz | gunzip > /usr/local/share/GeoIP/GeoLiteCityv6.dat" >> /usr/local/bin/geoipupdate.sh
# ASN Database (http://www.maxmind.com/en/asnum)
echo "fetch -o - http://geolite.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz | gunzip > /usr/local/share/GeoIP/GeoIPASNum.dat" >> /usr/local/bin/geoipupdate.sh
# GeoLite ASN IPv6
echo "fetch -o - http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNumv6.dat.gz | gunzip > /usr/local/share/GeoIP/GeoIPASNumv6.dat" >> /usr/local/bin/geoipupdate.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment