Reverse proxy (apache) problem

Dear experts,
I am stuck with trying to change my nextcloud behind a reverse proxy. It worked before without. But I want to move it behind this reverse proxy (with wild card certificate). So today I did a fresh install, but still no luck. Maybe someone can help me.

Ubuntu: 20.01 LTS
Nexcloud install with snap

Followed commands:
$ sudo snap install nextcloud
$ sudo nextcloud.manual-install admin ###password###
$ sudo snap set nextcloud ports.http=81
$ sudo nextcloud.occ config:system:set trusted_domains 0 --value=https://cloud.mydomain.com
$ sudo snap connect nextcloud:removable-media
$ sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php
–> I changed the data directory to the one that I use

$ sudo nano /etc/apache2/sites-available/000-default.conf
–> Here I pasted your code sniplet. Here I display my complete 000-default.conf (because I think the problem probably here). Ps: I am also running a jellyfin service @ jellyfin.mydomain.nl (that on works). On my host server I made 2 CNAME entries: 1= cloud@mydomain.nl and 2=jellyfin@mydomain.nl

============

<VirtualHost *:80>
ServerName mydomain.nl
ServerAdmin webmaster@mydomain.nl
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

<VirtualHost *:80>
ServerName jellyfin.mydomain.nl

# Uncomment for HTTP to HTTPS redirect
# Redirect permanent / https://DOMAIN_NAME

ErrorLog /var/log/apache2/DOMAIN_NAME-error.log
CustomLog /var/log/apache2/DOMAIN_NAME-access.log combined

If you are not using a SSL certificate, replace the ‘redirect’

line above with all lines below starting with ‘Proxy’

ServerName jellyfin.mydomain.nl # This folder exists just for certbot(You may have to create it, chown and chm> DocumentRoot /var/www/html/jellyfin/public_html
ProxyPreserveHost On

# Letsencrypt's certbot will place a file in this folder when updating/verifyi>
# This line will tell apache to not to use the proxy for this folder.
ProxyPass /.well_known/ !

ProxyPass "/socket" "ws://127.0.0.1:8096/socket"
ProxyPassReverse "/socket" "ws://127.0.0.1:8096/socket"

ProxyPass "/" "http://127.0.0.1:8096/"
ProxyPassReverse "/" "http://127.0.0.1:8096/"

SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/mydomain.nl/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.nl/privkey.pem
Protocols h2 http/1.1

# Enable only strong encryption ciphers and prefer versions with Forward Secre>
SSLCipherSuite HIGH:RC4-SHA:AES128-SHA:!aNULL:!MD5
SSLHonorCipherOrder on

Disable insecure SSL and TLS versions

SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1

ErrorLog /var/log/apache2/jellyfin.mydomain.nl-error.log
CustomLog /var/log/apache2/jellyfin.mydomain.nl-access.log combined

nextcloud

<VirtualHost *:80>
ServerName cloud.mydomain.nl
ServerAdmin webmaster@mydomain.nl
ProxyPreserveHost On
ProxyRequests Off
RewriteEngine On
RewriteRule ^/.well-known/carddav http://%{SERVER_NAME}/remote.php/dav/ [>
RewriteRule ^/.well-known/caldav http://%{SERVER_NAME}/remote.php/dav/ [R>
RewriteRule ^/.well-known/host-meta http://%{SERVER_NAME}/public.php?serv>
RewriteRule ^/.well-known/host-meta.json http://%{SERVER_NAME}/public.ph>
RewriteRule ^/.well-known/webfinger http://%{SERVER_NAME}/public.php?serv>
ProxyPass / http://localhost:81/
ProxyPassReverse / http://localhost:81/

vim: syntax=apache ts=4 sw=4 sts=4 sr noet

======================
if I enter https://cloud.mydomain.nl it redirects me to the standard apache, it works website that runs at the 80 port.

I really hope you can help me becaus it drives me crazy!
Thanks a lot!