From e68aa3806a372e48622f2b05d5cc67e21a6eab09 Mon Sep 17 00:00:00 2001 From: Manuel de Brito Fontes Date: Fri, 17 Jun 2016 18:26:08 -0400 Subject: [PATCH] Fix stats by country in nginx status page --- controllers/nginx/nginx.tmpl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/controllers/nginx/nginx.tmpl b/controllers/nginx/nginx.tmpl index 013c090ab..637e688ca 100644 --- a/controllers/nginx/nginx.tmpl +++ b/controllers/nginx/nginx.tmpl @@ -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")