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=
$ 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 @ (that on works). On my host server I made 2 CNAME entries: 1= and


<VirtualHost *:80>
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

<VirtualHost *:80>

# 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 # 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://"
ProxyPassReverse "/socket" "ws://"

ProxyPass "/" ""
ProxyPassReverse "/" ""

SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/
SSLCertificateKeyFile /etc/letsencrypt/live/
Protocols h2 http/1.1

# Enable only strong encryption ciphers and prefer versions with Forward Secre>
SSLHonorCipherOrder on

Disable insecure SSL and TLS versions

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

ErrorLog /var/log/apache2/
CustomLog /var/log/apache2/ combined


<VirtualHost *:80>
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}/>
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 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!