summaryrefslogtreecommitdiff
path: root/playbooks/templates/nginx/https.conf.j2
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks/templates/nginx/https.conf.j2')
-rw-r--r--playbooks/templates/nginx/https.conf.j260
1 files changed, 60 insertions, 0 deletions
diff --git a/playbooks/templates/nginx/https.conf.j2 b/playbooks/templates/nginx/https.conf.j2
new file mode 100644
index 0000000..4962040
--- /dev/null
+++ b/playbooks/templates/nginx/https.conf.j2
@@ -0,0 +1,60 @@
+server {
+ server_name {{ item.domains | join(' ') }};
+
+ listen 80;
+ listen [::]:80;
+
+ return 301 https://$host$request_uri;
+}
+
+server {
+ server_name {{ item.domains | join(' ') }};
+
+ listen 443 ssl;
+ listen [::]:443 ssl;
+
+ root /var/www/html;
+ index index.nginx-debian.html;
+
+ location / {
+ try_files $uri $uri/ =404;
+ }
+
+ ssl_certificate /etc/letsencrypt/live/{{ item.domains[0] }}/fullchain.pem;
+ ssl_certificate_key /etc/letsencrypt/live/{{ item.domains[0] }}/privkey.pem;
+ include /etc/letsencrypt/options-ssl-nginx.conf;
+ ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
+
+ access_log /var/log/nginx/{{ item.name }}/access.log;
+ error_log /var/log/nginx/{{ item.name }}/error.log;
+}
+server {
+ server_name {{ item.domains | join(' ') }};
+
+ listen 80;
+ listen [::]:80;
+
+ return 301 https://$host$request_uri;
+}
+
+server {
+ server_name {{ item.domains | join(' ') }};
+
+ listen 443 ssl;
+ listen [::]:443 ssl;
+
+ root /var/www/html;
+ index index.nginx-debian.html;
+
+ location / {
+ try_files $uri $uri/ =404;
+ }
+
+ ssl_certificate /etc/letsencrypt/live/{{ item.domains[0] }}/fullchain.pem;
+ ssl_certificate_key /etc/letsencrypt/live/{{ item.domains[0] }}/privkey.pem;
+ include /etc/letsencrypt/options-ssl-nginx.conf;
+ ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
+
+ access_log /var/log/nginx/{{ item.name }}/access.log;
+ error_log /var/log/nginx/{{ item.name }}/error.log;
+}