From d5e34d0a7776569e4cd43e0aa2984ec23084b8f7 Mon Sep 17 00:00:00 2001 From: Ludovic Poujol Date: Thu, 1 Sep 2022 12:40:36 +0200 Subject: [PATCH] webapp/nextcloud: Multiple changes in vhost - Have only one domain as ServerName (otherwise you get an invalid apache config - Add all other domains as ServerAlias - Remove auto redirect vers ServerName - Correct indentation --- webapps/nextcloud/templates/apache.conf.j2 | 30 ++++++++++------------ 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/webapps/nextcloud/templates/apache.conf.j2 b/webapps/nextcloud/templates/apache.conf.j2 index 20a4d2eb..6844933d 100644 --- a/webapps/nextcloud/templates/apache.conf.j2 +++ b/webapps/nextcloud/templates/apache.conf.j2 @@ -1,5 +1,9 @@ - ServerName {{ nextcloud_domains | join(' ') }} + ServerName {{ nextcloud_domains[0] }} + + {% for domain_alias in nextcloud_domains[1:] %} + ServerAlias {{ domain_alias }} + {% endfor %} DocumentRoot {{ nextcloud_webroot }}/ @@ -13,22 +17,16 @@ - # user - group (thanks to sesse@debian.org) - AssignUserID {{ nextcloud_instance_name }} {{ nextcloud_instance_name }} + # user - group (thanks to sesse@debian.org) + AssignUserID {{ nextcloud_user }} {{ nextcloud_user }} - # LOG - CustomLog /var/log/apache2/access.log vhost_combined - CustomLog /home/{{ nextcloud_instance_name }}/log/access.log combined - ErrorLog /home/{{ nextcloud_instance_name }}/log/error.log + # LOG + CustomLog /var/log/apache2/access.log vhost_combined + CustomLog /home/{{ nextcloud_instance_name }}/log/access.log combined + ErrorLog /home/{{ nextcloud_instance_name }}/log/error.log - # REWRITE - UseCanonicalName On - RewriteEngine On - RewriteCond %{HTTP_HOST} !^{{ nextcloud_domains | join(' ') }}$ - RewriteRule ^/(.*) http://%{SERVER_NAME}/$1 [L,R] - - # PHP - php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f {{ nextcloud_instance_name }}" - php_admin_value open_basedir "/usr/share/php:/home/{{ nextcloud_instance_name }}:/tmp" + # PHP + php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f {{ nextcloud_user }}" + php_admin_value open_basedir "/usr/share/php:{{ nextcloud_home }}:/tmp" \ No newline at end of file