summaryrefslogtreecommitdiff
path: root/roles/apache_server/templates/virtualhost.conf.tmpl
blob: 1fa060afa20c7ea7123f77edaed168478c0777b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<VirtualHost *:80>
    ServerName {{ item.domain }}
{% if item.alias is defined %}
    ServerAlias {{ item.alias }}
{% endif %}
    ServerAdmin {{ item.ownermail }}
    DocumentRoot /srv/http/{{ item.domain }}
    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 +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>