{{ ansible_managed | comment }}
ServerName {{nextcloud_server_names|first}}
{% for name in nextcloud_server_names | difference([nextcloud_server_names|first]) %}
ServerAlias {{name}}
{% endfor %}
SSLEngine on
SSLCertificateFile "/etc/ssl/certs/nextcloud.cert.pem"
SSLCertificateKeyFile "/etc/ssl/private/nextcloud.key.pem"
{% if not certificate_provider == "selfsigned" %}
SSLCertificateChainFile "/etc/ssl/certs/nextcloud.chain.pem"
{% endif %}
DocumentRoot {{nextcloud_directory}}
Options +FollowSymlinks
AllowOverride All
Dav off
SetEnv HOME {{nextcloud_directory}}
SetEnv HTTP_HOME {{nextcloud_directory}}
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName {{nextcloud_server_names|first}}
{% for name in nextcloud_server_names | difference(nextcloud_server_names|first) %}
ServerAlias {{name}}
{% endfor %}
RewriteEngine On
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]