diff --git a/roles/apache2/templates/etc/apache2/sites-available/site.conf.j2 b/roles/apache2/templates/etc/apache2/sites-available/site.conf.j2 index e1b131d..1ec4da0 100644 --- a/roles/apache2/templates/etc/apache2/sites-available/site.conf.j2 +++ b/roles/apache2/templates/etc/apache2/sites-available/site.conf.j2 @@ -3,22 +3,24 @@ {% if site.http_enabled | default(apache2_vhost_http_enabled) %} - ServerAdmin {{ site.serveradmin | default(apache2_vhost_serveradmin) }} - ServerName {{ name }} + ServerAdmin {{ site.serveradmin | default(apache2_vhost_serveradmin) }} + ServerName {{ name }} {% for alias in site.aliases | default(apache2_vhost_serveraliases) %} - ServerAlias {{ alias }} + ServerAlias {{ alias }} {% endfor %} - LogLevel {{ site.loglevel | default(apache2_vhost_loglevel) }} - ErrorLog {{ site.errorlog | default(apache2_vhost_errorlog) }} - CustomLog {{ site.accesslog | default(apache2_vhost_accesslog) }} + LogLevel {{ site.loglevel | default(apache2_vhost_loglevel) }} + ErrorLog {{ site.errorlog | default(apache2_vhost_errorlog) }} + CustomLog {{ site.accesslog | default(apache2_vhost_accesslog) }} {% if site.http_redirect_to_https | default(apache2_vhost_http_redirect_to_https) %} - Redirect permanent / https://{{ name }}/ -{% else %} - DocumentRoot {{ site.documentroot | default(apache2_vhost_documentroot) }} + Redirect permanent / https://{{ name }}/ + +{% else %} + DocumentRoot {{ site.documentroot | default(apache2_vhost_documentroot) }} + + {{ site.additional_config | indent(4) }} - {{ site.additional_config | indent(8) }} {% endif %} @@ -28,28 +30,28 @@ {% if site.https_enabled | default(apache2_vhost_https_enabled) %} - ServerAdmin {{ site.serveradmin | default(apache2_vhost_serveradmin) }} - ServerName {{ name }} + ServerAdmin {{ site.serveradmin | default(apache2_vhost_serveradmin) }} + ServerName {{ name }} {% for alias in site.aliases | default(apache2_vhost_serveraliases) %} - ServerAlias {{ alias }} + ServerAlias {{ alias }} {% endfor %} - LogLevel {{ site.loglevel | default(apache2_vhost_loglevel) }} - ErrorLog {{ site.errorlog | default(apache2_vhost_errorlog) }} - CustomLog {{ site.accesslog | default(apache2_vhost_accesslog) }} + LogLevel {{ site.loglevel | default(apache2_vhost_loglevel) }} + ErrorLog {{ site.errorlog | default(apache2_vhost_errorlog) }} + CustomLog {{ site.accesslog | default(apache2_vhost_accesslog) }} - SSLEngine on + SSLEngine on {% if certfile_exists and keyfile_exists %} - SSLCertificateFile {{ site.tls_certfile | default(apache2_tls_certfile) }} - SSLCertificateKeyFile {{ site.tls_keyfile | default(apache2_tls_keyfile) }} + SSLCertificateFile {{ site.tls_certfile | default(apache2_tls_certfile) }} + SSLCertificateKeyFile {{ site.tls_keyfile | default(apache2_tls_keyfile) }} {% else %} - SSLCertificateFile {{ apache2_tls_noacme_fallback_certfile }} - SSLCertificateKeyFile {{ apache2_tls_noacme_fallback_keyfile }} + SSLCertificateFile {{ apache2_tls_noacme_fallback_certfile }} + SSLCertificateKeyFile {{ apache2_tls_noacme_fallback_keyfile }} {% endif %} - DocumentRoot {{ site.documentroot | default(apache2_vhost_documentroot) }} + DocumentRoot {{ site.documentroot | default(apache2_vhost_documentroot) }} - {{ site.additional_config | indent(8) }} + {{ site.additional_config | indent(4) }} {% endif %}