summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Porte <microjoe@microjoe.org>2017-08-04 22:41:23 +0200
committerRomain Porte <microjoe@microjoe.org>2017-08-04 22:41:23 +0200
commitc32f627ad4ee38d4fb1027cd5bf1476727bff3a1 (patch)
treea294e0fffc388da599511be890723f56a3b69efa
parent56743c603e20d48b7aaf75f6279fc8f484e4d552 (diff)
downloadMicroJoe.nginx-staticwebsite-c32f627ad4ee38d4fb1027cd5bf1476727bff3a1.tar.gz
MicroJoe.nginx-staticwebsite-c32f627ad4ee38d4fb1027cd5bf1476727bff3a1.zip
Add basic_auth support
-rw-r--r--defaults/main.yml1
-rw-r--r--templates/nginx.j25
2 files changed, 6 insertions, 0 deletions
diff --git a/defaults/main.yml b/defaults/main.yml
index b4998d4..f993d36 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -5,6 +5,7 @@ nginx_root: "/var/www/{{ nginx_domain }}/"
nginx_filename: "static-{{ nginx_domain }}"
nginx_rewrite_html: false
nginx_customize: ""
+nginx_auth_file: ""
letsencrypt_wellknown: /var/www/letsencrypt
letsencrypt_activate: false
diff --git a/templates/nginx.j2 b/templates/nginx.j2
index fa2f238..184f912 100644
--- a/templates/nginx.j2
+++ b/templates/nginx.j2
@@ -48,6 +48,11 @@ server {
{% else %}
try_files $uri $uri/ =404;
{% endif %}
+
+ {% if nginx_auth_file %}
+ auth_basic "Restricted";
+ auth_basic_user_file {{ nginx_auth_file }};
+ {% endif %}
}
location ~ ~$ {