add support for location

This commit is contained in:
genofire 2020-07-21 02:37:37 +02:00
parent cd6fac6570
commit ef2bb3320a
3 changed files with 18 additions and 10 deletions

View File

@ -11,6 +11,7 @@
with_items: with_items:
- /srv/http/.well-known/acme-challenge - /srv/http/.well-known/acme-challenge
- /etc/nginx/sites.d - /etc/nginx/sites.d
- /etc/nginx/local.d
- /etc/nginx/snippets - /etc/nginx/snippets
- name: templates - name: templates
@ -48,12 +49,18 @@
line: "{{ inventory_hostname }}" line: "{{ inventory_hostname }}"
create: yes create: yes
- name: templates - name: templates tls
notify: reload nginx notify: reload nginx
template: template:
src: "10-tls.nginx" src: "10-tls.nginx"
dest: "/etc/nginx/sites.d/10-tls.act" 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 - name: enabled dehydrated
systemd: systemd:
name: dehydrated.timer name: dehydrated.timer

View File

@ -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;
}

View File

@ -7,15 +7,7 @@ server {
ssl_certificate /etc/dehydrated/certs/{{ inventory_hostname }}/fullchain.pem; ssl_certificate /etc/dehydrated/certs/{{ inventory_hostname }}/fullchain.pem;
ssl_certificate_key /etc/dehydrated/certs/{{ inventory_hostname }}/privkey.pem; ssl_certificate_key /etc/dehydrated/certs/{{ inventory_hostname }}/privkey.pem;
location / { include /etc/nginx/local.d/*.act;
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 snippets/letsencrypt.conf; include snippets/letsencrypt.conf;
} }