VirtualHost for nextcloud-docker-app

So to finish this here (I guess):

  1. make a file /etc/univention/templates/info/myname-nextcloud-vhost.info with a content like:
Type: file
File: etc/apache2/sites-available/nextcloud.conf
Variables: appcenter/apps/.*/ports/.*
  1. make a file /etc/univention/templates/files/etc/apache2/sites-available/nextcloud.conf:
<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerAdmin admin@TDL.de
        ServerName nextcloud.TDL.de
        DocumentRoot /var/www
        <Directory /var/www>
	  Options +FollowSymlinks
          AllowOverride All
	 <IfModule mod_dav.c>
	  Dav off
	 </IfModule>

	 SetEnv HOME /var/www
	 SetEnv HTTP_HOME /var/www

        </Directory>
        SSLEngine on
        SSLProxyEngine on
        SSLProxyCheckPeerCN off
        SSLProxyCheckPeerName off
	SSLCertificateFile /etc/univention/letsencrypt/signed.crt
	SSLCertificateKeyFile /etc/univention/letsencrypt/domain.key
	SSLCACertificateFile /etc/univention/ssl/ucsCA/CAcert.pem
	SSLCertificateChainFile /etc/univention/letsencrypt/intermediate.pem

<IfModule mod_headers.c>
 Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>
@!@
from univention.appcenter.app_cache import Apps
from univention.appcenter.utils import app_ports

for app_id, container_port, host_port in app_ports():
	app = Apps().find(app_id)
	if app and app.auto_mod_proxy and app.has_local_web_interface() and app_id == 'nextcloud':
		web_interface = '/'  # app.web_interface
		scheme = app.web_interface_proxy_scheme
		if scheme == 'both':
			scheme = 'https'
		if app.web_interface_port_https == container_port:
			print '''
	ProxyPass %(web_interface)s %(scheme)s://127.0.0.1:%(web_port)s%(web_interface)s retry=0
	ProxyPassReverse %(web_interface)s %(scheme)s://127.0.0.1:%(web_port)s%(web_interface)s
''' % {'id': app.id, 'web_interface': web_interface, 'web_port': host_port, 'scheme': scheme}
		else:
			# not relevant for mod_proxy
			continue
@!@
</VirtualHost>
</IfModule>
  1. now I can run ucr commit /etc/apache2/sites-available/nextcloud.conf
  2. and yes - I had to change the config.php inside the docker and set the overwrites to ‘/’. See Nextcloud Reverse Proxy ohne Unterverzeichnis /nextcloud

Time to get some sleep soon,
Bernd