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
This commit is contained in:
Ludovic Poujol 2022-09-01 12:40:36 +02:00
parent 1ad3e0de37
commit d5e34d0a77

View file

@ -1,5 +1,9 @@
<VirtualHost *:80> <VirtualHost *:80>
ServerName {{ nextcloud_domains | join(' ') }} ServerName {{ nextcloud_domains[0] }}
{% for domain_alias in nextcloud_domains[1:] %}
ServerAlias {{ domain_alias }}
{% endfor %}
DocumentRoot {{ nextcloud_webroot }}/ DocumentRoot {{ nextcloud_webroot }}/
@ -13,22 +17,16 @@
</IfModule> </IfModule>
</Directory> </Directory>
# user - group (thanks to sesse@debian.org) # user - group (thanks to sesse@debian.org)
AssignUserID {{ nextcloud_instance_name }} {{ nextcloud_instance_name }} AssignUserID {{ nextcloud_user }} {{ nextcloud_user }}
# LOG # LOG
CustomLog /var/log/apache2/access.log vhost_combined CustomLog /var/log/apache2/access.log vhost_combined
CustomLog /home/{{ nextcloud_instance_name }}/log/access.log combined CustomLog /home/{{ nextcloud_instance_name }}/log/access.log combined
ErrorLog /home/{{ nextcloud_instance_name }}/log/error.log ErrorLog /home/{{ nextcloud_instance_name }}/log/error.log
# REWRITE # PHP
UseCanonicalName On php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f {{ nextcloud_user }}"
RewriteEngine On php_admin_value open_basedir "/usr/share/php:{{ nextcloud_home }}:/tmp"
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"
</VirtualHost> </VirtualHost>