2022-08-04 17:32:23 +02:00
|
|
|
{% if 'address' in ansible_default_ipv6 %}
|
2020-12-06 13:22:54 +01:00
|
|
|
<VirtualHost {{ ansible_default_ipv4.address }}:80 [{{ ansible_default_ipv6.address }}]:80>
|
2022-08-04 17:32:23 +02:00
|
|
|
{% else %}
|
|
|
|
<VirtualHost {{ ansible_default_ipv4.address }}:80>
|
|
|
|
{% endif %}
|
2020-11-23 16:25:40 +01:00
|
|
|
ServerAdmin {{ server_admin }}
|
|
|
|
ServerName {{ site_name }}
|
|
|
|
ServerAlias {{ site_name }}
|
|
|
|
ErrorLog /var/log/apache2/{{ site_name }}-error.log
|
|
|
|
CustomLog /var/log/apache2/{{ site_name }}-access.log common
|
|
|
|
|
2022-09-08 15:41:36 +02:00
|
|
|
Alias /.well-known/acme-challenge {{ dehydrated_wellknown_dir }}
|
2020-12-04 18:54:21 +01:00
|
|
|
|
2020-11-23 16:25:40 +01:00
|
|
|
<ifmodule mod_rewrite.c>
|
|
|
|
RewriteEngine On
|
|
|
|
RewriteCond %{REQUEST_URI} !^/\.well\-known/acme\-challenge/
|
|
|
|
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
|
|
|
|
</ifmodule>
|
|
|
|
</VirtualHost>
|
|
|
|
|
2022-09-14 23:24:55 +02:00
|
|
|
<IfFile {{dehydrated_certs_dir}}/{{ site_name }}/cert.pem>
|
|
|
|
<IfFile {{dehydrated_certs_dir}}/{{ site_name }}/privkey.pem>
|
|
|
|
<IfFile {{dehydrated_certs_dir}}/{{ site_name }}/chain.pem>
|
2022-08-04 17:32:23 +02:00
|
|
|
{% if 'address' in ansible_default_ipv6 %}
|
2020-12-06 13:22:54 +01:00
|
|
|
<VirtualHost {{ ansible_default_ipv4.address }}:443 [{{ ansible_default_ipv6.address }}]:443>
|
2022-08-04 17:32:23 +02:00
|
|
|
{% else %}
|
|
|
|
<VirtualHost {{ ansible_default_ipv4.address }}:443>
|
|
|
|
{% endif %}
|
2020-11-23 16:25:40 +01:00
|
|
|
ServerAdmin {{ server_admin }}
|
|
|
|
ServerName {{ site_name }}
|
|
|
|
ServerAlias {{ site_name }}
|
|
|
|
|
|
|
|
ErrorLog /var/log/apache2/{{ site_name }}-error.log
|
|
|
|
CustomLog /var/log/apache2/{{ site_name }}-access.log common
|
|
|
|
|
|
|
|
SSLEngine on
|
|
|
|
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
|
2022-09-14 23:24:55 +02:00
|
|
|
SSLCertificateFile {{dehydrated_certs_dir}}/{{ site_name }}/cert.pem
|
|
|
|
SSLCertificateKeyFile {{dehydrated_certs_dir}}/{{ site_name }}/privkey.pem
|
|
|
|
SSLCertificateChainFile {{dehydrated_certs_dir}}/{{ site_name }}/chain.pem
|
2020-11-23 16:25:40 +01:00
|
|
|
|
2022-09-14 23:24:55 +02:00
|
|
|
{% if proxy_port %}
|
2022-09-06 15:35:50 +02:00
|
|
|
AllowEncodedSlashes NoDecode
|
|
|
|
ProxyPass / http://{{ backend_host | default("localhost") }}:{{proxy_port}}/ nocanon
|
2022-07-04 13:59:13 +02:00
|
|
|
RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
|
|
|
|
RequestHeader set "X-Forwarded-SSL" expr=%{HTTPS}
|
|
|
|
|
2022-07-04 14:01:09 +02:00
|
|
|
<ifmodule mod_rewrite.c>
|
|
|
|
# see documentation of wstunnel: This allwos generic websocket passthrough
|
|
|
|
RewriteEngine On
|
|
|
|
RewriteCond %{HTTP:Upgrade} websocket [NC]
|
|
|
|
RewriteCond %{HTTP:Connection} upgrade [NC]
|
|
|
|
RewriteRule ^/?(.*) "ws://{{ backend_host | default("localhost") }}:{{ proxy_port }}/$1" [P,L]
|
|
|
|
</ifmodule>
|
2022-09-14 23:24:55 +02:00
|
|
|
{% else %}
|
2022-09-08 15:43:54 +02:00
|
|
|
Redirect 404 /
|
2022-09-14 23:24:55 +02:00
|
|
|
{% endif %}
|
2020-11-23 16:25:40 +01:00
|
|
|
</VirtualHost>
|
2020-12-12 16:26:12 +01:00
|
|
|
</IfFile>
|
2022-07-04 14:01:33 +02:00
|
|
|
</IfFile>
|
|
|
|
</IfFile>
|