diff --git a/playbooks/proxy.yml b/playbooks/proxy.yml index a75cf95..8784d10 100644 --- a/playbooks/proxy.yml +++ b/playbooks/proxy.yml @@ -67,31 +67,3 @@ - role: nginx/site site: zm.foo.sh proxy: https://zm02.home.foo.sh/ - - tasks: - - name: create extra nginx config directories - file: - path: /etc/nginx/conf.d/www.foo.sh - state: directory - mode: 0755 - owner: root - group: "{{ ansible_wheel }}" - - name: install redirects config for www.foo.sh - copy: - dest: /etc/nginx/conf.d/www.foo.sh/redirects.conf - content: | - location /collab/ { return 301 https://collab.foo.sh/; } - mode: 0644 - owner: root - group: "{{ ansible_wheel }}" - notify: restart nginx - - name: install proxy config for www.foo.sh - copy: - dest: /etc/nginx/conf.d/www.foo.sh/proxy.conf - content: | - location /roles/ { proxy_pass https://static02.home.foo.sh/roles/; } - location /~ { proxy_pass https://static02.home.foo.sh/~; } - mode: 0644 - owner: root - group: "{{ ansible_wheel }}" - notify: restart nginx diff --git a/roles/nginx/site/templates/site.conf.j2 b/roles/nginx/site/templates/site.conf.j2 index 87685ef..efe811e 100644 --- a/roles/nginx/site/templates/site.conf.j2 +++ b/roles/nginx/site/templates/site.conf.j2 @@ -26,6 +26,7 @@ server { ssl_certificate {{ tls_certs }}/{{ site }}-fullchain.crt; ssl_certificate_key {{ tls_private }}/{{ site }}.key; +{% include "./{}.conf.j2".format(site) ignore missing %} {% if redirect is defined %} return 301 {{ redirect }}; {% elif proxy is defined %} @@ -41,7 +42,6 @@ server { {% else %} root /srv/web/{{ site }}; {% endif %} - include /etc/nginx/conf.d/{{ site }}/*.conf; } server { diff --git a/roles/nginx/site/templates/www.foo.sh.conf.j2 b/roles/nginx/site/templates/www.foo.sh.conf.j2 new file mode 100644 index 0000000..ad34c06 --- /dev/null +++ b/roles/nginx/site/templates/www.foo.sh.conf.j2 @@ -0,0 +1,11 @@ + location /collab/ { + return 301 https://collab.foo.sh/collab/; + } + + location /roles/ { + proxy_pass https://static02.home.foo.sh/roles/; + } + location /~ { + proxy_pass https://static02.home.foo.sh/~; + } +