Enable HTTPS sites only when cert exists

This commit is contained in:
Stefan Haun 2020-12-12 16:26:12 +01:00
parent 1ed05c94f1
commit c5dac00a36
2 changed files with 4 additions and 0 deletions

View file

@ -14,6 +14,7 @@
</ifmodule> </ifmodule>
</VirtualHost> </VirtualHost>
<IfFile /usr/local/etc/dehydrated/certs/{{ site_name }}>
<VirtualHost {{ ansible_default_ipv4.address }}:443 [{{ ansible_default_ipv6.address }}]:80> <VirtualHost {{ ansible_default_ipv4.address }}:443 [{{ ansible_default_ipv6.address }}]:80>
ServerAdmin {{ server_admin }} ServerAdmin {{ server_admin }}
ServerName {{ site_name }} ServerName {{ site_name }}
@ -36,3 +37,4 @@
RewriteRule (.*) {{forward_to}} [R=301,L] RewriteRule (.*) {{forward_to}} [R=301,L]
</ifmodule> </ifmodule>
</VirtualHost> </VirtualHost>
</IfFile>

View file

@ -14,6 +14,7 @@
</ifmodule> </ifmodule>
</VirtualHost> </VirtualHost>
<IfFile /usr/local/etc/dehydrated/certs/{{ site_name }}>
<VirtualHost {{ ansible_default_ipv4.address }}:443 [{{ ansible_default_ipv6.address }}]:443> <VirtualHost {{ ansible_default_ipv4.address }}:443 [{{ ansible_default_ipv6.address }}]:443>
ServerAdmin {{ server_admin }} ServerAdmin {{ server_admin }}
ServerName {{ site_name }} ServerName {{ site_name }}
@ -30,3 +31,4 @@
ProxyPass / http://localhost:{{proxy_port}}/ ProxyPass / http://localhost:{{proxy_port}}/
</VirtualHost> </VirtualHost>
</IfFile>