mirror of
https://github.com/linuxserver/docker-swag.git
synced 2024-10-01 01:35:49 -04:00
84 lines
2.4 KiB
Plaintext
84 lines
2.4 KiB
Plaintext
## Version 2020/09/20 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/geoip2.conf
|
|
# To enable, uncommment the Geoip2 config line in nginx.conf
|
|
# Add the -e MAXMINDDB_LICENSE_KEY=<licensekey> to automatically download the Geolite2 database.
|
|
# A Maxmind lisence key can be aqiured here: https://www.maxmind.com/en/geolite2/signup
|
|
# The below config is for geoblocking any country/city you add. The default config is blocking all countries/cities except the ones you set to "yes".
|
|
# If you want to do the opposite, set default to "yes", and the countries/cities to "no".
|
|
# As the default config blocks all IP's except the ones in the GeoLite2-City.mmdb database set to yes, you will need to allow your lan ip for local access.
|
|
|
|
|
|
geoip2 /config/geoip2db/GeoLite2-City.mmdb {
|
|
auto_reload 5m;
|
|
$geoip2_data_country_code country iso_code;
|
|
$geoip2_data_city_name city names en;
|
|
}
|
|
|
|
# GEOIP2 COUNTRY CONFIG
|
|
map $geoip2_data_country_code $allowed_country {
|
|
default no;
|
|
<COUNTRY-CODE> yes; # e.g GB yes; for United Kingdom
|
|
IP/CIDR yes; # e.g. 192.168.1.0/24 yes; for local access.
|
|
}
|
|
|
|
#(Optional)
|
|
# GEOIP2 CITY CONFIG
|
|
# map $geoip2_data_city_name $allowed_city {
|
|
# default no;
|
|
# <CITY-NAME> yes; # e.g Inverness yes;
|
|
# IP/CIDR yes; # e.g. 192.168.1.0/24 yes; for local access.
|
|
# }
|
|
|
|
|
|
# Server config example:
|
|
# Add the following if statement inside any server context you want to geo block.
|
|
|
|
# COUNTRY GEO BLOCK
|
|
# if ($allowed_country = no) {
|
|
# return 444;
|
|
# }
|
|
|
|
# Full example:
|
|
|
|
# sample config for "default" with the geo block added
|
|
#server {
|
|
# listen 443 ssl http2 default_server;
|
|
# listen [::]:443 ssl http2 default_server;
|
|
#
|
|
# root /config/www;
|
|
# index index.html index.htm index.php;
|
|
#
|
|
# server_name _;
|
|
|
|
|
|
# COUNTRY GEO BLOCK
|
|
# if ($allowed_country = no) {
|
|
# return 444;
|
|
# }
|
|
|
|
|
|
# # enable subfolder method reverse proxy confs
|
|
# include /config/nginx/proxy-confs/*.subfolder.conf;
|
|
#
|
|
# # all ssl related config moved to ssl.conf
|
|
# include /config/nginx/ssl.conf;
|
|
#
|
|
# # enable for ldap auth
|
|
# #include /config/nginx/ldap.conf;
|
|
#
|
|
# # enable for Authelia
|
|
# #include /config/nginx/authelia-server.conf;
|
|
#
|
|
# client_max_body_size 0;
|
|
#
|
|
# location / {
|
|
# try_files $uri $uri/ /index.html /index.php?$args =404;
|
|
# }
|
|
#
|
|
# location ~ \.php$ {
|
|
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
|
# fastcgi_pass 127.0.0.1:9000;
|
|
# fastcgi_index index.php;
|
|
# include /etc/nginx/fastcgi_params;
|
|
# }
|
|
#}
|