[solved] Problems after migration local Nextcloud to Docker with Traefik as reverse proxy

Hello,

I have a problem with my Nextcloud installation/configuration. I hope this is the right topic for it.
I was using Nextcloud on my Raspberry Pi 4 with Apache2 as webserver. These was running great i could upload new files, download files, show my photos etc.

Few days ago I decided to put the local installed Nextcloud instance in a docker container. I´ve googled and I found a manual on the official docker hub nextcloud page (Docker) at the bottom.
I did the steps and the Nextcloud instance was accessible from the local IP. But I want that I could use Nextcloud from outside of my home.
I decided to use traefik, which I use for a few more docker containers.
I have rewritten the docker-compose file from the Nextcloud to accessible it from outside. That works fine. I can access my nextcloud instance from outside over my domain.
So but I have a few problems now.

The first is when I want to show a photo in the Browser, Nextcloud says “Error at loading Photo-xxx-xxx-xx.jpg”.
Also an error occours when I use the Nextcloud Programm on my Windows PC.

Here are the log file from the Nextcloud Container, when i want to take a look at a photo:

Nextcloud Error Log

nextcloud_server_1 | 172.25.0.7 - - [27/Mar/2020:12:05:22 +0000] “PROPFIND /remote.php/dav/files/username/path-to-photo/Photo%xxxx%xxxx%205710.jpg HTTP/1.1” 207 1901 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”

nextcloud_server_1 | 172.25.0.7 - - [27/Mar/2020:12:05:22 +0000] “PROPFIND /remote.php/dav/files/username/path-to-photo HTTP/1.1” 207 46554 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”

nextcloud_server_1 | 172.25.0.7 - - [27/Mar/2020:12:05:22 +0000] “GET /core/preview?fileId=33388&x=1920&y=1080&a=true HTTP/1.1” 404 711 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”

nextcloud_server_1 | 172.25.0.7 - - [27/Mar/2020:12:05:22 +0000] “GET /core/preview?fileId=33389&x=1920&y=1080&a=true HTTP/1.1” 404 711 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”

nextcloud_server_1 | 172.25.0.7 - - [27/Mar/2020:12:05:22 +0000] “GET /remote.php/dav/files/username/path-to-photo/Video%xxxx%xxxx%%205543.mov HTTP/1.1” 503 11005 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”

When i look at the error log it seems for me that Nextcloud want to GET a video instead of a photo. But i do not understand why. Are the fingerprints wrong?
Maybe I can fix it with this command?:

sudo -u www-data php occ maintenance:data-fingerprint

The other problem is after switching to docker image, I can not use the App Passwords. It says to me that https:// is required.
But when I access my Nextcloud instance I use https://. If i want to use the app i should switch to my old Nextcloud instance.
Below the error are several links to documentation sites. I tried these but it is still not accessible.

image001

Here are the docker-compose.yml files and config.php files:

docker-compose.yml Traefik

version: “3.3”
services:
traefik:
image: “traefik:v2.1.8”
command:
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --providers.docker
- --api
- --certificatesresolvers.leresolver.acme.caserver=https://acme-v01.api.letsencrypt.org/directory
- --certificatesresolvers.leresolver.acme.email=e-mail address
- --certificatesresolvers.leresolver.acme.storage=/acme.json
- --certificatesresolvers.leresolver.acme.tlschallenge=true
- --log.level=DEBUG
ports:
- “80:80”
- “443:443”
volumes:
- “/var/run/docker.sock:/var/run/docker.sock:ro”
- “./letsencrypt/acme.json:/acme.json”
labels:
# Dashboard
- “traefik.http.routers.traefik.rule=Host(proxydomain)”
- “traefik.http.routers.traefik.service=api@internal”
- “traefik.http.routers.traefik.tls.certresolver=leresolver”
- “traefik.http.routers.traefik.entrypoints=websecure”
- “traefik.http.routers.traefik.middlewares=authtraefik”
- “traefik.http.middlewares.authtraefik.basicauth.users=admin:superstrongpassword” # user/password
# global redirect to https
- “traefik.http.routers.http-catchall.rule=hostregexp({host:.+})”
- “traefik.http.routers.http-catchall.entrypoints=web”
- “traefik.http.routers.http-catchall.middlewares=redirect-to-https”
# middleware redirect
- “traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https”
networks:
- web
networks:
web:
external: true

docker-compose.yml Nextcloud

version: ‘3.3’
volumes:
nextcloud_data:
nextcloud_db:
services:
nextcloud_db:
image: mariadb
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
restart: always
labels:
- traefik.enable=false
volumes:
- nextcloud_db:/var/lib/mysql
- /backup:/backup
environment:
- MYSQL_ROOT_PASSWORD=reallyStrongPassword
- MYSQL_PASSWORD=anotherStrong Password
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud_user
networks:
- internal
nextcloud_server:
image: nextcloud:17.0
labels:
- “traefik.docker.network=web”
- “traefik.http.routers.nextcloud.rule=Host(domain1,´domain2´)”
- “traefik.http.routers.nextcloud.tls=true”
- “traefik.http.routers.nextcloud.tls.certresolver=leresolver”
- “traefik.http.services.nextcloud.loadbalancer.server.port=80”
- “traefik.http.routers.nextcloud.entrypoints=websecure”
# Reverse-Proxy “Traefik” Redirects für CalDAV / CardDAV:
- “traefik.http.middlewares.calcarddav.redirectregex.permanent=true”
- “traefik.http.middlewares.calcarddav.redirectregex.regex=https://(.*)/.well-known/(card|cal)dav”
-“traefik.http.middlewares.calcarddav.redirectregex.replacement=https://$${1}/remote.php/dav/”
# - “traefik.http.routers.nextcloud-sec.middlewares=calcarddav”
links:
- nextcloud_db
depends_on:
- nextcloud_db
volumes:
- nextcloud_data:/var/www/html
restart: always
networks:
- web
- internal
networks:
web:
external: true
internal:
external: false

config.php Nexctloud docker
<?php

$CONFIG = array (
‘instanceid’ => ‘oclorr9hqnhs’,
‘passwordsalt’ => ‘DQviA/YpyUbMCWI6XYa6H/j+Q8r4XG’,
‘secret’ => ‘8I4OXX/wcLY6u4Y1tCmGKqJpL7F8EXogs1HIidoX0WS26sdW’,
‘trusted_domains’ =>
array (
0 => ‘192.168.1.12’,
1 => ‘domain1’,
2 => ‘domain2’,
),
‘datadirectory’ => ‘/var/www/html/data’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘17.0.4.2’,
‘overwrite.cli.url’ => ‘http://192.168.1.12/nextcloud’,
‘dbname’ => ‘nextcloud’,
‘dbhost’ => ‘nextcloud_db:3306’,
‘dbport’ => ‘’,
‘dbtableprefix’ => ‘oc_’,
‘mysql.utf8mb4’ => true,
‘dbuser’ => ‘nextcloud_user’,
‘dbpassword’ => ‘anotherStrong Password’,
‘installed’ => true,
‘maintenance’ => false,
‘data-fingerprint’ => ‘60092014328bb67396a838d464db71d0’,
‘updater.secret’ => ‘$2y$10$Ar.Fvb8jtE8Lp6FYPUPgWuAkiXD7ujcvjaZekMkD2F9lcIlEa3pFO’,
‘htaccess.RewriteBase’ => ‘/’,
‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘apps_paths’ =>
array (
0 =>
array (
‘path’ => ‘/var/www/html/apps’,
‘url’ => ‘/apps’,
‘writable’ => false,
),
1 =>
array (
‘path’ => ‘/var/www/html/custom_apps’,
‘url’ => ‘/custom_apps’,
‘writable’ => true,
),
),
‘theme’ => ‘’,
‘loglevel’ => 2,
);

config.php Nextcloud local
<?php

$CONFIG = array (
‘instanceid’ => ‘oclorr9hqnhs’,
‘passwordsalt’ => ‘DQviA/YpyUbMCWI6XYa6H/j+Q8r4XG’,
‘secret’ => ‘8I4OXX/wcLY6u4Y1tCmGKqJpL7F8EXogs1HIidoX0WS26sdW’,
‘trusted_domains’ =>
array (
0 => ‘192.168.1.12’,
1 => ‘domain1’,
2 => ‘domain2’,
),
‘datadirectory’ => ‘/var/www/html/Nextcloud/data’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘17.0.0.9’,
‘overwrite.cli.url’ => ‘http://192.168.1.12/nextcloud’,
‘dbname’ => ‘nextcloud’,
‘dbhost’ => ‘localhost’,
‘dbport’ => ‘’,
‘dbtableprefix’ => ‘oc_’,
‘mysql.utf8mb4’ => true,
‘dbuser’ => ‘nextcloud_user’,
‘dbpassword’ => ‘anotherStrong Password’,
‘installed’ => true,
‘maintenance’ => false,
‘data-fingerprint’ => ‘4634e22ded6144e98e0b1d9a40330869’,
‘updater.secret’ => ‘$2y$10$Ar.Fvb8jtE8Lp6FYPUPgWuAkiXD7ujcvjaZekMkD2F9lcIlEa3pFO’,
‘theme’ => ‘’,
‘loglevel’ => 2,
);

Thank you for your time to help me.

With best regards
Sebastian

Hey guys,

i fixed my problems. So this can be closed.
I used a workaroudn for the problem that I can´t take a look at my photos. So I deleted them from NextCloud and added them new to my NextCloud instance. So this solved my first problem.

The second problem that I have with the passwords app is solved too.
I have to add these lines in my config.php file:

‘trusted_proxies’ => [‘traefik’],
‘overwriteprotocol’ => ‘https’,

I just added them a few days before I post this error here in the forum. But when I copied it to my nextcloud container, I can´t access my nextcloud container. I just forgot to set the user rights for it…so I just added the right user rights to it (www-data, apache2 instance) and it works.

I hope i can help others with my problem.

1 Like