wmdeit-cf-wmdelib/templates/httpd-vhost.conf.mustache

71 lines
2.8 KiB
Plaintext

#
# Managed by CFEengine
#
<Directory {{vars.apache_vhost.site.doc_root}}>
AllowOverride all
Options {{ vars.apache_vhost.site.doc_root_options }}
Require all granted
{{#vars.apache_vhost.site.php}}
<FilesMatch ".+(\.php)$">
SetHandler {{vars.apache_vhost.site.php_handler}}
</FilesMatch>
{{/vars.apache_vhost.site.php}}
DirectoryIndex index.php index.html
{{{vars.apache_vhost.site.dir_raw}}}
</Directory>
{{^vars.apache_vhost.site.ssl}}
<VirtualHost *:80>
ServerName {{vars.apache_vhost.site.domain}}
RewriteEngine On
Alias /.well-known/acme-challenge/ "{{vars.apache.default_html_dir}}/.well-known/acme-challenge/"
RewriteRule "^/.well-known/acme-challenge/" - [L]
DocumentRoot "{{vars.apache_vhost.site.doc_root}}"
ServerAlias {{#vars.apache_vhost.site.aliases}}{{.}} {{/vars.apache_vhost.site.aliases}}
{{#vars.apache_vhost.site.logging80}}
ErrorLog "{{vars.apache.log_dir}}/{{vars.apache_vhost.site.domain}}-error.log"
CustomLog "{{vars.apache.log_dir}}/{{vars.apache_vhost.site.domain}}-access.log" combined
{{/vars.apache_vhost.site.logging80}}
{{vars.apache_vhost.site.raw}}
</VirtualHost>
{{/vars.apache_vhost.site.ssl}}
{{#vars.apache_vhost.site.ssl}}
<VirtualHost *:80>
ServerName {{vars.apache_vhost.site.domain}}
ServerAlias {{#vars.apache_vhost.site.aliases}}{{.}} {{/vars.apache_vhost.site.aliases}}
RewriteEngine On
Alias /.well-known/acme-challenge/ "{{vars.apache.default_html_dir}}/.well-known/acme-challenge/"
RewriteRule "^/.well-known/acme-challenge/" - [L]
DocumentRoot "{{vars.apache_vhost.site.doc_root}}"
# Redirect permanent / https://{{vars.apache_vhost.site.domain}}/
RewriteRule ^(.*)$ https://{{vars.apache_vhost.site.domain}}$1 [R=301,L]
</VirtualHost>
<VirtualHost *:443>
ServerAdmin {{vars.apache_vhost.site.email}}
DocumentRoot "{{vars.apache_vhost.site.doc_root}}"
ServerName {{vars.apache_vhost.site.domain}}
ServerAlias {{#vars.apache_vhost.site.aliases}}{{.}} {{/vars.apache_vhost.site.aliases}}
{{#vars.apache_vhost.site.logging443}}
ErrorLog "{{vars.apache.log_dir}}/{{vars.apache_vhost.site.domain}}-error.log"
CustomLog "{{vars.apache.log_dir}}/{{vars.apache_vhost.site.domain}}-access.log" combined
{{/vars.apache_vhost.site.logging443}}
# SSL
SSLEngine on
# SSLCertificateFile {{vars.certbot.certbot_dir}}/live/{{vars.apache_vhost.site.domain}}/fullchain.pem
# SSLCertificateKeyFile {{vars.certbot.certbot_dir}}/live/{{vars.apache_vhost.site.domain}}/privkey.pem
SSLCertificateFile {{vars.apache_vhost.ssl_cert}}
SSLCertificateKeyFile {{vars.apache_vhost.ssl_key}}
RewriteEngine On
Alias /.well-known/acme-challenge/ "{{vars.apache.default_html_dir}}/.well-known/acme-challenge/"
RewriteRule "^/.well-known/acme-challenge/" - [L]
<Location /.well-known/acme-challenge/ >
</Location>
{{{vars.apache_vhost.site.raw}}}
</VirtualHost>
{{/vars.apache_vhost.site.ssl}}