Merge "Deprecating stats.conf in favor of static type:"
diff --git a/README.rst b/README.rst
index 927eaaf..eadade3 100644
--- a/README.rst
+++ b/README.rst
@@ -499,7 +499,43 @@
                 enabled: true
                 value: '$server_port'
 
-Nginx stats server (required by collectd nginx plugin):
+Define site catalog indexes:
+
+.. code-block:: yaml
+
+    nginx:
+      server:
+        enabled: true
+        site:
+          nginx_catalog:
+            enabled: true
+            type: nginx_static
+            name: server
+            indexes:
+            - index.htm
+            - index.html
+            host:
+              name: 127.0.0.1
+              port: 80
+
+Define site catalog autoindex:
+
+.. code-block:: yaml
+
+    nginx:
+      server:
+        enabled: true
+        site:
+          nginx_catalog:
+            enabled: true
+            type: nginx_static
+            name: server
+            autoindex: True
+            host:
+              name: 127.0.0.1
+              port: 80
+
+Nginx stats server (required by collectd nginx plugin) (DEPRECATED):
 
 .. code-block:: yaml
 
@@ -515,6 +551,26 @@
               name: 127.0.0.1
               port: 8888
 
+or:
+
+.. code-block:: yaml
+
+    nginx:
+      server:
+        enabled: true
+        site:
+          nginx_stats_server:
+            enabled: true
+            root: disabled
+            indexes: []
+            stats: True
+            type: nginx_static
+            name: stat_server
+            host:
+              name: 127.0.0.1
+              address: 127.0.0.1
+              port: 8888
+
 Nginx configured to wait for another service/s before
 starting (currently only with systemd):
 
diff --git a/metadata/service/server/stats.yml b/metadata/service/server/stats.yml
index 76b32b8..130dae1 100644
--- a/metadata/service/server/stats.yml
+++ b/metadata/service/server/stats.yml
@@ -4,8 +4,12 @@
       site:
         nginx_stats_server:
           enabled: true
-          type: nginx_stats
+          type: nginx_static
+          stats: True
+          indexes: []
+          root: disabled
           name: stats
           host:
             name: 127.0.0.1
+            address: 127.0.0.1
             port: 8888
diff --git a/nginx/files/_log.conf b/nginx/files/_log.conf
index b1c1a42..4bbe554 100644
--- a/nginx/files/_log.conf
+++ b/nginx/files/_log.conf
@@ -1,5 +1,9 @@
 {%- from "nginx/map.jinja" import server with context -%}
 {%- set site = salt['pillar.get']('nginx:server:site:'+site_name) %}
 
+{%- if site.get('log', {}).get('enabled', True) %}
   access_log {{ site.get('log', {}).get('access', server.log_dir + '/' + site_name + '-access.log') }};
   error_log {{ site.get('log', {}).get('error', server.log_dir + '/' + site_name + '-error.log') }};
+{%- else %}
+  access_log off;
+{%- endif %}
diff --git a/nginx/files/static.conf b/nginx/files/static.conf
index 2a6ad57..50b74e8 100644
--- a/nginx/files/static.conf
+++ b/nginx/files/static.conf
@@ -8,14 +8,25 @@
 
   location / {
     {%- if site.root is defined %}
+    {%- if site.root != "disabled" %}
     root  {{ site.root }};
+    {%- endif %}
     {%- else %}
     root  /srv/static/sites/{{ site.name }}{% if site.path is defined %}/{{ site.path }}{% endif %};
     {%- endif %}
+    {%- if site.get('stats', False) %}
+    stub_status on;
+    {%- endif %}
 
     {%- include "nginx/files/_access_policy.conf" %}
 
-    index  index.html  index.htm;
+    {%- if site.indexes is defined and site.indexes is mapping %}
+    {% if site.indexes.length != 0 %}
+    index {{ ' '.join(site.indexes) }};
+    {%- endif %}
+    {%- else %}
+    index index.html index.htm;
+    {%- endif %}
     {%- if site.get('autoindex', False) %}
     autoindex on;
     {%- endif %}
diff --git a/tests/pillar/static.sls b/tests/pillar/static.sls
index 1a40205..0b58cd4 100644
--- a/tests/pillar/static.sls
+++ b/tests/pillar/static.sls
@@ -19,4 +19,21 @@
         host:
           name: cloudlab.domain.com
           port: 80
-
+      nginx_catalog1:
+        enabled: true
+        type: nginx_static
+        name: server
+        indexes:
+        - index.htm
+        - index.html
+        host:
+          name: 127.0.0.2
+          port: 80
+      nginx_catalog2:
+        enabled: true
+        type: nginx_static
+        name: server
+        autoindex: True
+        host:
+          name: 127.0.0.3
+          port: 80
diff --git a/tests/pillar/stats.sls b/tests/pillar/stats.sls
index 5095255..74c314c 100644
--- a/tests/pillar/stats.sls
+++ b/tests/pillar/stats.sls
@@ -16,4 +16,14 @@
         host:
           name: 127.0.0.1
           port: 8888
-
+      nginx_stats_server2:
+        enabled: true
+        root: disabled
+        stats: True
+        indexes: []
+        type: nginx_static
+        name: stats_server
+        host:
+          name: 127.0.0.1
+          address: 127.0.0.1
+          port: 8889