Nextcloud traefik configuration is not working

Hi,

Im trying to set nextcloud up with traefik reverse proxy. My yml file is looking like this:

version: “3.3”

services:

traefik:
image: “traefik:v2.10”
container_name: “traefik”
command:
#- “–log.level=DEBUG”
- “–api.insecure=true”
- “–api.dashboard=true”
- “–providers.docker=true”
- “–providers.docker.exposedbydefault=false”
- “–entrypoints.websecure.address=:443”
- “–certificatesresolvers.myresolver.acme.tlschallenge=true”
#- “–certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
- “--certificatesresolvers.myresolver.acme.email=mymail@myserver.dns.net
- “–certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json”
ports:
- “443:443”
# - “80:80”
# - “8065:8065”
# - “8080:8080”
volumes:
- “./letsencrypt:/letsencrypt”
- “/var/run/docker.sock:/var/run/docker.sock:ro”

labels:
  - "traefik.enable=true"
  - "traefik.http.routers.traefik.rule=Host(`myserver.dns.net`)"
  - "traefik.http.routers.traefik.entrypoints=websecure"
  - "traefik.http.routers.traefik.tls.certresolver=myresolver"
  - "traefik.http.routers.traefik.service=api@internal"
networks:
  - traefik_network      

whoami:
image: “traefik/whoami”
container_name: “simple-service”
labels:
- “traefik.enable=true”
- “traefik.http.routers.whoami.rule=Host(myserver.dns.net) && PathPrefix(/whoami)”
- “traefik.http.routers.whoami.entrypoints=websecure”
- “traefik.http.routers.whoami.tls.certresolver=myresolver”

networks:
  - traefik_network      

nextcloud:
image: nextcloud:latest
container_name: “nextcloud”
labels:
- “traefik.enable=true”
- “traefik.http.routers.nextcloud.rule=Host(myserver.dns.net) && PathPrefix(/nextcloud)”
- “traefik.http.routers.nextcloud.entrypoints=websecure”
- “traefik.http.routers.nextcloud.tls.certresolver=myresolver”
volumes:
- “/containers/cloud/nextcloud/apps:/var/www/html/apps”
- “/containers/cloud/nextcloud/config:/var/www/html/config”
- “/containers/cloud/nextcloud/data:/var/www/html/data”
depends_on:
- db
networks:
- traefik_network

db:
container_name: “maria-db”
restart: unless-stopped
image: mariadb
command: --innodb-read-only-compressed=OFF #Maria-DB fix
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: ncdb
MYSQL_USER: nextcloud
MYSQL_PASSWORD: nextcloud
volumes:
- “/containers/cloud/mariadb:/var/lib/mysql”
networks:
- traefik_network
networks:
traefik_network:

→ Traefik dashboard and whoami is available,
But the address myserver.dns.net/nextcloud says:

" Not Found

The requested URL was not found on this server.


Apache/2.4.52 (Debian) Server at myserver.dns.net Port 80"

Can somebody help me to fix this issue?

I don’t have a specific answer for you but the use of paths in nextcloud (ie https://domain.com/nextcloud) has for years caused a lot of problems. I’m not sure why. The sane advice is to use a subdomain instead (ie https://nextcloud.domain.com or nc.domain.com or something similar).

Maybe it is as easy as: Configuration Parameters — Nextcloud latest Administration Manual latest documentation and Configuration Parameters — Nextcloud latest Administration Manual latest documentation in config.php (overwritewebroot and overwrite-cli-url ).

you config looks pretty good… I would recommend you enable traefik access log - then you can easily track where the request is routed (don’t provide a file and it will log to STDOUT by default and you can easily monitor logs real-life “docker logs traefik -f”).

The other issue - which not related to your problem - you must advise NC it’s run behind reverse proxy by adding OVERWRITE* parameters to config.php (docker ENV variables only work for very first container start)