summaryrefslogtreecommitdiff
path: root/roles/nginx/vhost/templates/tlsonly.conf.j2
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2023-10-09 16:07:55 +0200
committerChristian Pointner <equinox@spreadspace.org>2023-10-09 16:07:55 +0200
commit9b5da334fa74cb994e41a778713c8670f50c1690 (patch)
tree91ddfa45d56b15e95345aad5927e0422518ef35b /roles/nginx/vhost/templates/tlsonly.conf.j2
parentsk-cloudio: new nextcloud instanze luzesombra.skillz.biz (diff)
nginx/vhost: refactor templates and add tlsonly variant
Diffstat (limited to 'roles/nginx/vhost/templates/tlsonly.conf.j2')
-rw-r--r--roles/nginx/vhost/templates/tlsonly.conf.j226
1 files changed, 26 insertions, 0 deletions
diff --git a/roles/nginx/vhost/templates/tlsonly.conf.j2 b/roles/nginx/vhost/templates/tlsonly.conf.j2
new file mode 100644
index 00000000..2af0e7ad
--- /dev/null
+++ b/roles/nginx/vhost/templates/tlsonly.conf.j2
@@ -0,0 +1,26 @@
+server {
+ listen {{ nginx_vhost.tls.port | default(443) }} ssl http2{% if 'default' in nginx_vhost and nginx_vhost.default %} default_server{% endif %};
+ listen [::]:{{ nginx_vhost.tls.port | default(443) }} ssl http2{% if 'default' in nginx_vhost and nginx_vhost.default %} default_server{% endif %};
+ server_name {{ nginx_vhost.hostnames | join(' ') }};
+
+{% if 'logs' in nginx_vhost %}
+{% if 'access' in nginx_vhost.logs %}
+ access_log {{ nginx_vhost.logs.access }};
+{% endif %}
+{% if 'error' in nginx_vhost.logs %}
+ error_log {{ nginx_vhost.logs.error }};
+{% endif %}
+
+{% endif %}
+{% if nginx_vhost.tls.certificate_provider == 'acmetool' or nginx_vhost.tls.certificate_provider == 'uacme' %}
+ include snippets/{{ nginx_vhost.tls.certificate_provider }}.conf;
+{% endif %}
+ include snippets/tls{% if 'variant' in nginx_vhost.tls %}-{{ nginx_vhost.tls.variant }}{% endif %}.conf;
+ ssl_certificate {{ x509_certificate_path_fullchain }};
+ ssl_certificate_key {{ x509_certificate_path_key }};
+{% if 'hsts' not in nginx_vhost.tls or nginx_vhost.tls.hsts %}
+ include snippets/hsts.conf;
+{% endif %}
+
+{% include 'includes/body.j2' %}
+}