From ef2bb3320a8e462f776d50f84342e3d0b0378be1 Mon Sep 17 00:00:00 2001 From: genofire Date: Tue, 21 Jul 2020 02:37:37 +0200 Subject: [PATCH] add support for location --- tasks/main.yml | 9 ++++++++- templates/10-tls.local.nginx | 9 +++++++++ templates/10-tls.nginx | 10 +--------- 3 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 templates/10-tls.local.nginx diff --git a/tasks/main.yml b/tasks/main.yml index a96306e..a77446d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -11,6 +11,7 @@ with_items: - /srv/http/.well-known/acme-challenge - /etc/nginx/sites.d + - /etc/nginx/local.d - /etc/nginx/snippets - name: templates @@ -48,12 +49,18 @@ line: "{{ inventory_hostname }}" create: yes -- name: templates +- name: templates tls notify: reload nginx template: src: "10-tls.nginx" dest: "/etc/nginx/sites.d/10-tls.act" +- name: templates local.d + notify: reload nginx + template: + src: "10-tls.local.nginx" + dest: "/etc/nginx/local.d/10-tls.act" + - name: enabled dehydrated systemd: name: dehydrated.timer diff --git a/templates/10-tls.local.nginx b/templates/10-tls.local.nginx new file mode 100644 index 0000000..e662ef1 --- /dev/null +++ b/templates/10-tls.local.nginx @@ -0,0 +1,9 @@ +location / { + root /usr/share/nginx/html; + index index.html index.htm; +} + +error_page 500 502 503 504 /50x.html; +location = /50x.html { + root /usr/share/nginx/html; +} diff --git a/templates/10-tls.nginx b/templates/10-tls.nginx index ee5a432..0f0cc67 100644 --- a/templates/10-tls.nginx +++ b/templates/10-tls.nginx @@ -7,15 +7,7 @@ server { ssl_certificate /etc/dehydrated/certs/{{ inventory_hostname }}/fullchain.pem; ssl_certificate_key /etc/dehydrated/certs/{{ inventory_hostname }}/privkey.pem; - location / { - root /usr/share/nginx/html; - index index.html index.htm; - } - - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/html; - } + include /etc/nginx/local.d/*.act; include snippets/letsencrypt.conf; }