version: '3'
services:

  nginx:
    networks:
      - traefik
      - default
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=traefik"
      - "traefik.http.routers.nextcloud.rule=Host(`${HOST}`)"
      - "traefik.http.routers.nextcloud.tls.certresolver=myresolver"
      - "traefik.http.routers.nextcloud.entrypoints=web,websecure"
      - "traefik.http.routers.nextcloud.middlewares=hardening@docker,nextcloud_redirectregex"
      - "traefik.http.middlewares.nextcloud_redirectregex.redirectregex.permanent=true"
      - "traefik.http.middlewares.nextcloud_redirectregex.redirectregex.regex=https://(.*)/.well-known/(?:card|cal)dav"
      - "traefik.http.middlewares.nextcloud_redirectregex.redirectregex.replacement=https://$${1}/remote.php/dav"


networks:
  traefik:
    external: true
