roles/nginx: Allow sites to override the root

This commit is contained in:
Alan Orth 2020-12-28 22:53:32 +02:00
parent e1b412bfff
commit 73d6abd15f
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
1 changed files with 5 additions and 0 deletions

View File

@ -26,7 +26,12 @@ server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
{# Allow sites to override the nginx document root #}
{% if item.document_root is defined %}
root {{ item.document_root }};
{% else %}
root {{ nginx_root_prefix }}/{{ domain_name }};
{% endif %}
{# will only work if the TLS cert covers the domain + aliases, like example.com and www.example.com #}
server_name {{ domain_name }} {{ domain_aliases }};