roles/nginx: smarter setting of document root
This commit is contained in:
parent
84db337fea
commit
7f9b06af9c
@ -8,6 +8,12 @@
|
||||
{% set has_wordpress = item.has_wordpress | default(false) %}
|
||||
{% set needs_php = item.needs_php | default(false) %}
|
||||
{% set has_gitea = item.has_gitea | default(false) %}
|
||||
{# Allow sites to override the document root #}
|
||||
{% if item.document_root is defined %}
|
||||
{% set document_root = item.document_root %}
|
||||
{% else %}
|
||||
{% set document_root = (nginx_root_prefix, domain_name) | ansible.builtin.path_join %}
|
||||
{% endif %}
|
||||
|
||||
# http -> https vhost
|
||||
server {
|
||||
@ -29,12 +35,7 @@ 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 %}
|
||||
root {{ document_root }};
|
||||
|
||||
{# will only work if the TLS cert covers the domain + aliases, like example.com and www.example.com #}
|
||||
server_name {{ domain_name }} {{ domain_aliases }};
|
||||
|
Loading…
x
Reference in New Issue
Block a user