blob: 50b74e888031f6b8b2899e066218c8f780020ddd [file] [log] [blame]
{%- set site = salt['pillar.get']('nginx:server:site:'+site_name) %}
server {
{%- include "nginx/files/_name.conf" %}
{%- include "nginx/files/_log.conf" %}
{%- include "nginx/files/_ssl.conf" %}
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" %}
{%- 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 %}
{%- if site.webdav is defined %}
{%- if site.webdav.methods is defined %}
autoindex on;
dav_methods {{ site.webdav.methods }};
{%- endif %}
{%- if site.webdav.ext_methods is defined %}
dav_ext_methods {{ site.webdav.ext_methods }};
{%- endif %}
{%- if site.webdav.access is defined %}
dav_access {{ site.webdav.access }};
{%- endif %}
{%- endif %}
{%- if site.client_max_body_size is defined %}
client_max_body_size {{ site.client_max_body_size }};
{%- endif %}
{%- include "nginx/files/_auth.conf" %}
}
}