blob: 12a682e6c146fadf876f0b2e6494e6103a97a96c (
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
{% if apache_use_ssl and apache_redirect_to_https %}
<VirtualHost {{ apache_listen }}:80>
ServerName {{ apache_server_name }}
{% for alias in apache_server_aliases %}
ServerAlias {{ alias }}
{% endfor %}
ErrorLog "logs/{{ apache_server_name }}.error_log"
CustomLog "logs/{{ apache_server_name }}.access_log" combined
Protocols {% if apache_use_http2 %}h2c {% endif %}http/1.1
RewriteEngine On
RewriteCond %{REQUEST_URI} !^\/\.well-known\/acme-challenge\/.*$
RewriteRule (.*) https://%{HTTP_HOST}$1 [R=permanent,L]
</VirtualHost>
{% else %}
{% if apache_canonical_hostname is defined and (apache_server_aliases | length > 0) %}
<VirtualHost {{ apache_listen }}:80>
{% for alias in ([apache_server_name] + apache_server_aliases) | reject('equalto', apache_canonical_hostname) | list %}
{% if loop.first %}
ServerName {{ alias }}
{% else %}
ServerAlias {{ alias }}
{% endif %}
{% endfor %}
ErrorLog "logs/{{ apache_server_name }}.error_log"
CustomLog "logs/{{ apache_server_name }}.access_log" combined
Protocols {% if apache_use_http2 %}h2c {% endif %}http/1.1
RedirectMatch Permanent ^(?!/\.well-known/acme-challenge/).* http://{{ apache_canonical_hostname }}/$0
</VirtualHost>
{% endif %}
<VirtualHost {{ apache_listen }}:80>
{% if apache_document_root is defined %}
DocumentRoot "{{ apache_document_root }}"
{% endif %}
{% if apache_canonical_hostname is defined %}
ServerName {{ apache_canonical_hostname }}
{% else %}
ServerName {{ apache_server_name }}
{% for alias in apache_server_aliases %}
ServerAlias {{ alias }}
{% endfor %}
{% endif %}
ErrorLog "logs/{{ apache_server_name }}.error_log"
CustomLog "logs/{{ apache_server_name }}.access_log" combined
Protocols {% if apache_use_http2 %}h2c {% endif %}http/1.1
{% if apache_document_root is defined and not apache_config is search('<Directory\s+"' + apache_document_root + '">') %}
<Directory "{{ apache_document_root }}">
Options +FollowSymLinks
AllowOverride None
Require all granted
{% if apache_autoindex %}
Options +Indexes
{% endif %}
</Directory>
{% endif %}
{{ apache_config }}
</VirtualHost>
{% endif %}
{% if apache_use_ssl %}
{% if apache_canonical_hostname is defined and (apache_server_aliases | length > 0) %}
<VirtualHost {{ apache_listen }}:443>
{% for alias in ([apache_server_name] + apache_server_aliases) | reject('equalto', apache_canonical_hostname) | list %}
{% if loop.first %}
ServerName {{ alias }}
{% else %}
ServerAlias {{ alias }}
{% endif %}
{% endfor %}
ErrorLog "logs/{{ apache_server_name }}.error_log"
CustomLog "logs/{{ apache_server_name }}.access_log" combined
Protocols {% if apache_use_http2 %}h2 {% endif %}http/1.1
SSLEngine on
SSLCertificateFile {{ apache_certificate_path }}
SSLCertificateKeyFile {{ apache_certificate_key_path }}
Header always set Strict-Transport-Security "max-age=63072000"
Redirect permanent / https://{{ apache_canonical_hostname }}/
</VirtualHost>
{% endif %}
<VirtualHost {{ apache_listen }}:443>
{% if apache_document_root is defined %}
DocumentRoot "{{ apache_document_root }}"
{% endif %}
{% if apache_canonical_hostname is defined %}
ServerName {{ apache_canonical_hostname }}
{% else %}
ServerName {{ apache_server_name }}
{% for alias in apache_server_aliases %}
ServerAlias {{ alias }}
{% endfor %}
{% endif %}
ErrorLog "logs/{{ apache_server_name }}.error_log"
CustomLog "logs/{{ apache_server_name }}.access_log" combined
Protocols {% if apache_use_http2 %}h2 {% endif %}http/1.1
SSLEngine on
SSLCertificateFile {{ apache_certificate_path }}
SSLCertificateKeyFile {{ apache_certificate_key_path }}
Header always set Strict-Transport-Security "max-age=63072000"
{% if apache_document_root is defined and not apache_config is search('<Directory\s+"' + apache_document_root + '">') %}
<Directory "{{ apache_document_root }}">
Options +FollowSymLinks
AllowOverride None
Require all granted
{% if apache_autoindex %}
Options +Indexes
{% endif %}
</Directory>
{% endif %}
{{ apache_config }}
</VirtualHost>
{% endif %}
|