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

54 lines
2.3 KiB
Plaintext

#
# Managed by CFEengine
#
<Directory {{vars.apache.www_dir}}/{{vars.apache_vhost.site.domain}}>
AllowOverride all
Options Indexes FollowSymLinks
Require all granted
<FilesMatch ".+(\.php)$">
SetHandler application/x-httpd-php
</FilesMatch>
DirectoryIndex index.php index.html
</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.www_dir}}/{{vars.apache_vhost.site.domain}}"
ServerAlias {{#vars.apache_vhost.site.aliases}}{{.}} {{/vars.apache_vhost.site.aliases}}
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
</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.www_dir}}/{{vars.apache_vhost.site.domain}}"
Redirect permanent / https://{{vars.apache_vhost.site.domain}}/
</VirtualHost>
<VirtualHost *:443>
ServerAdmin {{vars.apache_vhost.site.email}}
DocumentRoot "{{vars.apache.www_dir}}/{{vars.apache_vhost.site.domain}}"
ServerName {{vars.apache_vhost.site.domain}}
ServerAlias {{#vars.apache_vhost.site.aliases}}{{.}} {{/vars.apache_vhost.site.aliases}}
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
# 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
RewriteEngine On
Alias /.well-known/acme-challenge/ "{{vars.apache.default_html_dir}}/.well-known/acme-challenge/"
RewriteRule "^/.well-known/acme-challenge/" - [L]
</VirtualHost>
{{/vars.apache_vhost.site.ssl}}