summaryrefslogtreecommitdiff
path: root/roles/apache_server/templates
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2018-02-14 17:21:11 +0200
committerLars Wirzenius <liw@liw.fi>2018-02-14 17:21:11 +0200
commit6d8fc6b0d76f3dddabeba61365e6036dd869a917 (patch)
tree95946706339a225cc75e1596d86c1d7c64a0bd45 /roles/apache_server/templates
parente7afc13285b725faf0bdcadbb3cc4888e1f81b64 (diff)
downloaddebian-ansible-6d8fc6b0d76f3dddabeba61365e6036dd869a917.tar.gz
Change: optionally install a per-site htpasswd file
Also, configure the Apache vhost to use the file if installed.
Diffstat (limited to 'roles/apache_server/templates')
-rw-r--r--roles/apache_server/templates/virtualhost.conf.tmpl9
1 files changed, 8 insertions, 1 deletions
diff --git a/roles/apache_server/templates/virtualhost.conf.tmpl b/roles/apache_server/templates/virtualhost.conf.tmpl
index e2dc19f..1fa060a 100644
--- a/roles/apache_server/templates/virtualhost.conf.tmpl
+++ b/roles/apache_server/templates/virtualhost.conf.tmpl
@@ -8,8 +8,15 @@
ErrorLog /var/log/apache2/{{ item.domain }}/error.log
CustomLog /var/log/apache2/{{ item.domain }}/access.log combined
<Directory /srv/http/{{ item.domain }}>
- Options +SymlinksIfOwnerMatch +Indexes
+ Options +SymlinksIfOwnerMatch +Indexes +MultiViews
+{% if item.htpasswd is defined %}
+ AuthType Basic
+ AuthName "{{ item.htpasswd_name }}"
+ AuthUserFile "/srv/http/{{ item.domain }}.htpasswd"
+ Require valid-user
+{% else %}
AllowOverride AuthConfig
Require all granted
+{% endif %}
</Directory>
</VirtualHost>