From c85806e3289b5e207d51d382f8dc75edad04404d Mon Sep 17 00:00:00 2001 From: Kumar Damani Date: Tue, 23 Aug 2022 12:02:28 -0400 Subject: switched to alpine initial commit --- roles/nginx_docker/templates/app.nginx.conf.j2 | 25 +++++++++++++++++++++++++ roles/nginx_docker/templates/http.nginx.conf.j2 | 24 ++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 roles/nginx_docker/templates/app.nginx.conf.j2 create mode 100644 roles/nginx_docker/templates/http.nginx.conf.j2 (limited to 'roles/nginx_docker/templates') diff --git a/roles/nginx_docker/templates/app.nginx.conf.j2 b/roles/nginx_docker/templates/app.nginx.conf.j2 new file mode 100644 index 0000000..82c3610 --- /dev/null +++ b/roles/nginx_docker/templates/app.nginx.conf.j2 @@ -0,0 +1,25 @@ +server { + listen 443 ssl; + root _; + server_name {{ item.conf.access_domain }}; + ssl_certificate /etc/letsencrypt/live/{{ nginx_global_apps_domain }}/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/{{ nginx_global_apps_domain }}/privkey.pem; + ssl_protocols TLSv1.1 TLSv1.2; + ssl_ciphers HIGH:!aNULL:!MD5; + + location / { +{% if item.app == "nextcloud" %} {# Nextcloud requires https internally #} + proxy_pass https://127.0.0.1:{{ item.conf.port }}; +{% else %} + proxy_pass http://127.0.0.1:{{ item.conf.port }}; +{% endif %} + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $server_name; + proxy_set_header X-Forwarded-Proto https; + proxy_read_timeout 1200s; + client_max_body_size 0; + error_log /var/log/nginx/{{ item.app }}.error.log; + } +} diff --git a/roles/nginx_docker/templates/http.nginx.conf.j2 b/roles/nginx_docker/templates/http.nginx.conf.j2 new file mode 100644 index 0000000..2d4c61b --- /dev/null +++ b/roles/nginx_docker/templates/http.nginx.conf.j2 @@ -0,0 +1,24 @@ +server { + {% if item == "default" %} + listen 80 default_server; + server_name _; + return 301 https://$host$request_uri; + {% else %} + listen 443 ssl; + root /var/www/{{ item }}/html; + server_name {{ item }} www.{{ item }}; + ssl_certificate /etc/letsencrypt/live/{{ item }}/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/{{ item }}/privkey.pem; + ssl_protocols TLSv1.1 TLSv1.2; + ssl_ciphers HIGH:!aNULL:!MD5; + index index.html index.htm index.nginx-debian.html; + + location ~ /.well-known { + allow all; + } + + location / { + try_files $uri $uri/ =404; + } + {% endif %} +} -- cgit v1.2.3