This repository was archived by the owner on Apr 17, 2019. It is now read-only.
File tree 2 files changed +18
-1
lines changed
ingress/controllers/nginx
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,12 @@ RUN apt-get update && apt-get install -y \
19
19
--no-install-recommends \
20
20
&& rm -rf /var/lib/apt/lists/*
21
21
22
+ # Download of GeoIP databases
23
+ RUN curl -sSL -o /etc/nginx/GeoIP.dat.gz http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz \
24
+ && curl -sSL -o /etc/nginx/GeoLiteCity.dat.gz http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz \
25
+ && gunzip /etc/nginx/GeoIP.dat.gz \
26
+ && gunzip /etc/nginx/GeoLiteCity.dat.gz
27
+
22
28
COPY nginx-ingress-controller /
23
29
COPY nginx.tmpl /etc/nginx/template/nginx.tmpl
24
30
COPY default.conf /etc/nginx/nginx.conf
Original file line number Diff line number Diff line change @@ -16,7 +16,16 @@ events {
16
16
}
17
17
18
18
http {
19
- {{ if $cfg.enableVtsStatus}}vhost_traffic_status_zone shared:vhost_traffic_status:{{ $cfg.vtsStatusZoneSize }};{{ end }}
19
+ {{/* databases used to determine the country depending on the client IP address */}}
20
+ {{/* http://nginx.org/en/docs/http/ngx_http_geoip_module.html */}}
21
+ {{/* this is require to calculate traffic for individual country using GeoIP in the status page */}}
22
+ geoip_country /etc/nginx/GeoIP.dat;
23
+ geoip_city /etc/nginx/GeoLiteCity.dat;
24
+
25
+ {{- if $cfg.enableVtsStatus }}
26
+ vhost_traffic_status_zone shared:vhost_traffic_status:{{ $cfg.vtsStatusZoneSize }};
27
+ vhost_traffic_status_filter_by_set_key $geoip_country_code country::*;
28
+ {{ end -}}
20
29
21
30
# lus sectrion to return proper error codes when custom pages are used
22
31
lua_package_path '.?.lua;./etc/nginx/lua/?.lua;/etc/nginx/lua/vendor/lua-resty-http/lib/?.lua;';
@@ -166,6 +175,8 @@ http {
166
175
more_set_headers "Strict-Transport-Security: max-age={{ $cfg.hstsMaxAge }}{{ if $cfg.hstsIncludeSubdomains }}; includeSubDomains{{ end }}; preload";
167
176
{{ end -}}
168
177
178
+ {{ if $cfg.enableVtsStatus }}vhost_traffic_status_filter_by_set_key $geoip_country_code country::$server_name;{{ end }}
179
+
169
180
{{ range $location := $server.Locations }}
170
181
location {{ $location.Path }} {
171
182
proxy_set_header Host $host;
You can’t perform that action at this time.
0 commit comments