blob: 8d069ceca289e6e477384915d8338b670117cdbd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
<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 }}>
{% if item.letsencrypt|default(false) %}
Redirect permanent / "https://{{ item.domain }}/"
Require all granted
{% else %}
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 %}
{% endif %}
</Directory>
Alias /.well-known/ /srv/letsencrypt/{{ item.domain }}/
<Directory /srv/letsencrypt/{{ item.domain }}>
Require all granted
</Directory>
</VirtualHost>
{% if item.letsencrypt|default(false) %}
<VirtualHost _default_:443>
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>
SSLEngine on
SSLCertificateFile "/etc/letsencrypt/live/{{ item.letsencrypt_cert|default('static_sites') }}/fullchain.pem"
SSLCertificateKeyFile "/etc/letsencrypt/live/{{ item.letsencrypt_cert|default('static_sites') }}/privkey.pem"
</VirtualHost>
{% endif %}
|