Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1235 from aledbf/fix-geoip
Browse files Browse the repository at this point in the history
Fix stats by country in nginx status page
  • Loading branch information
bprashanth authored Jun 20, 2016
2 parents 8bb606d + a152cc4 commit eeecaa2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ingress/controllers/nginx/nginx.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,24 @@ events {
}

http {
{{/* we use the value of the header X-Forwarded-For to be able to use the geo_ip module */}}
real_ip_header X-Forwarded-For;
set_real_ip_from 0.0.0.0/0;
real_ip_recursive on;

{{/* databases used to determine the country depending on the client IP address */}}
{{/* http://nginx.org/en/docs/http/ngx_http_geoip_module.html */}}
{{/* this is require to calculate traffic for individual country using GeoIP in the status page */}}
geoip_country /etc/nginx/GeoIP.dat;
geoip_city /etc/nginx/GeoLiteCity.dat;
geoip_proxy_recursive on;

{{- if $cfg.enableVtsStatus }}
vhost_traffic_status_zone shared:vhost_traffic_status:{{ $cfg.vtsStatusZoneSize }};
vhost_traffic_status_filter_by_set_key $geoip_country_code country::*;
{{ end -}}

# lus sectrion to return proper error codes when custom pages are used
# lua section to return proper error codes when custom pages are used
lua_package_path '.?.lua;./etc/nginx/lua/?.lua;/etc/nginx/lua/vendor/lua-resty-http/lib/?.lua;';
init_by_lua_block {
require("error_page")
Expand Down

0 comments on commit eeecaa2

Please sign in to comment.