summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Porte <microjoe@microjoe.org>2017-07-01 23:16:51 +0200
committerRomain Porte <microjoe@microjoe.org>2017-07-01 23:17:00 +0200
commit77030e1b2505fc5d2d0bb54bc6aba986d4f36fb3 (patch)
tree6a0e995e2f28c9f21340e5012bc92fe8aace1544
parent6f82fe51b1809012c467ec2595a3dd2a5cdad652 (diff)
downloadMicroJoe.nginx-staticwebsite-77030e1b2505fc5d2d0bb54bc6aba986d4f36fb3.tar.gz
MicroJoe.nginx-staticwebsite-77030e1b2505fc5d2d0bb54bc6aba986d4f36fb3.zip
Introduced letsencrypt domain
-rw-r--r--defaults/main.yml3
-rw-r--r--templates/nginx.j210
2 files changed, 7 insertions, 6 deletions
diff --git a/defaults/main.yml b/defaults/main.yml
index 5db7a83..b4998d4 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -2,13 +2,14 @@
# defaults file for MicroJoe.staticwebsite
nginx_root: "/var/www/{{ nginx_domain }}/"
-nginx_filename: "static-{{ nginx_domain }}.conf"
+nginx_filename: "static-{{ nginx_domain }}"
nginx_rewrite_html: false
nginx_customize: ""
letsencrypt_wellknown: /var/www/letsencrypt
letsencrypt_activate: false
letsencrypt_https: false
+letsencrypt_domain: "{{ nginx_domain }}"
upload_user: ssh-http-upload
upload_group: www-data
diff --git a/templates/nginx.j2 b/templates/nginx.j2
index aceef2a..47454bf 100644
--- a/templates/nginx.j2
+++ b/templates/nginx.j2
@@ -9,7 +9,7 @@ server {
error_log /var/log/nginx/{{ nginx_domain }}.error.log;
{% if letsencrypt_activate %}
- location .well-known {
+ location ^~ /.well-known/ {
root {{ letsencrypt_wellknown }};
}
@@ -28,8 +28,8 @@ server {
error_log /var/log/nginx/{{ nginx_domain }}.error.log;
ssl on;
- ssl_certificate /etc/letsencrypt/live/{{ nginx_domain }}/fullchain.pem;
- ssl_certificate_key /etc/letsencrypt/live/{{ nginx_domain }}/privkey.pem;
+ ssl_certificate /etc/letsencrypt/live/{{ letsencrypt_domain }}/fullchain.pem;
+ ssl_certificate_key /etc/letsencrypt/live/{{ letsencrypt_domain }}/privkey.pem;
include /etc/nginx/snippets/ssl.conf;
@@ -41,9 +41,9 @@ server {
location / {
{% if nginx_rewrite_html %}
- try_files $uri $uri/ =404;
- {% else %}
try_files $uri.html $uri/ =404;
+ {% else %}
+ try_files $uri $uri/ =404;
{% endif %}
}