From 662daf13518d1a6e0ae59682f146202fc6496eae Mon Sep 17 00:00:00 2001
From: Brad Ison <bison@xvdf.io>
Date: Tue, 24 Jul 2018 13:15:19 -0400
Subject: [PATCH] Add config for nginx vhost-traffic-status module

---
 conf/nginx/nginx.conf.jnj            | 20 ++++++++++++++++++++
 conf/nginx/root-base.conf            |  2 ++
 conf/nginx/vhost-traffic-status.conf |  7 +++++++
 3 files changed, 29 insertions(+)
 create mode 100644 conf/nginx/vhost-traffic-status.conf

diff --git a/conf/nginx/nginx.conf.jnj b/conf/nginx/nginx.conf.jnj
index a9e3cd77e..2b2275d1f 100644
--- a/conf/nginx/nginx.conf.jnj
+++ b/conf/nginx/nginx.conf.jnj
@@ -11,6 +11,8 @@ http {
 
     resolver 127.0.0.1 valid=10s;
 
+    vhost_traffic_status_zone;
+
     ssl_certificate ../stack/ssl.cert;
     ssl_certificate_key ../stack/ssl.key;
     ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
@@ -52,6 +54,14 @@ http {
 
         access_log /dev/stdout lb_logs;
     }
+
+    server {
+        include vhost-traffic-status.conf;
+
+        listen 9080 default;
+
+        access_log /dev/stdout lb_logs;
+    }
 }
 
 {% else %}
@@ -62,6 +72,8 @@ http {
 
     resolver 127.0.0.1 valid=10s;
 
+    vhost_traffic_status_zone;
+
     server {
         include server-base.conf;
 
@@ -69,6 +81,14 @@ http {
 
         access_log /dev/stdout lb_logs;
     }
+
+    server {
+        include vhost-traffic-status.conf;
+
+        listen 9080 default;
+
+        access_log /dev/stdout lb_logs;
+    }
 }
 
 {% endif %}
diff --git a/conf/nginx/root-base.conf b/conf/nginx/root-base.conf
index 31afc6f82..86a42d3a4 100644
--- a/conf/nginx/root-base.conf
+++ b/conf/nginx/root-base.conf
@@ -1,5 +1,7 @@
 # vim: ft=nginx
 
+load_module modules/ngx_http_vhost_traffic_status_module.so;
+
 pid /tmp/nginx.pid;
 error_log /dev/stdout;
 
diff --git a/conf/nginx/vhost-traffic-status.conf b/conf/nginx/vhost-traffic-status.conf
new file mode 100644
index 000000000..a041cd96b
--- /dev/null
+++ b/conf/nginx/vhost-traffic-status.conf
@@ -0,0 +1,7 @@
+# vim: ft=nginx
+
+server_name _;
+
+root /dev/null;
+
+vhost_traffic_status_display;