Skip to content

How to redirect to Nextcloud Docker container? #102

@AlexCreamer

Description

@AlexCreamer

Bear with me. I'm new to Caddy. New to Tailscale. New to Nextcloud.

I'm trying to access my Nextcloud via Caddy which is accessed via Tailscale. All three are in Docker containers. I tried following the following example but am still struggling: nextcloud/all-in-one#575

When I try to access my site via http, port 80, and no path, I get brought to a welcome page for Caddy saying "Caddy works! Congratulations! Your web server is working."

And my Caddy/Tailscale container is able to communicate with my Nextcloud container when I sh into the container and try to ping. But the redirect isn't working when trying to access it via my browser doesn't work. I tried using /web_app, /web_app2, as shown in my Caddy file below, on both http and https and neither gives me results. I'm not able to connect with either of those.

This is my HTTP port 80 display if I don't add a path:

Image

Caddyfile

{
        tailscale {
                auth_key tskey-auth-H54H54H5-GRGH453G45
                hostname nextcloud-aio-mastercontainer:11000

                web_app {
                        auth_key tskey-auth-H54H54H5-GRGH453G45
                        hostname nextcloud-aio-mastercontainer:11000
                }
                web_app2 {
                        auth_key tskey-auth-H54H54H5-GRGH453G45
                        hostname nextcloud-aio-mastercontainer:11000
                }
        }
}
:80 {
        bind tailscale/web_app
}

:443 {
        bind tailscale/web_app2
}

caddy-tailscale container

services:
  caddy:
      environment:
        TS_AUTH_KEY:  tskey-auth-H54H54H5-GRGH453G45
        APACHE_PORT: 11000
      volumes:
        - ./Caddyfile:/etc/caddy/Caddyfile
      build:
          dockerfile_inline: |
            FROM docker.io/caddy:2.9-builder AS builder
            RUN xcaddy build \
              --with github.com/tailscale/caddy-tailscale
            FROM docker.io/caddy:2.9
            COPY --from=builder /usr/bin/caddy /usr/bin/caddy
      ports:
        - 80:80
        - 443:443
      networks:
        - nextcloud-aio

volumes:
  caddy_certs:
  caddy_data:
  caddy_config:
  tailscale:
  tailscale_sock:

networks:
  home_default:
    external: true
  nextcloud-aio:
    name: nextcloud-aio
    external: true

Nextcloud container

services:
  nextcloud-aio-mastercontainer:
    image: ghcr.io/nextcloud-releases/all-in-one:beta
    init: true
    restart: always
    container_name: nextcloud-aio-mastercontainer # This line is not allowed to be changed as otherwise AIO will not work correctly
    volumes:
      - nextcloud_aio_mastercontainer:/mnt/docker-aio-config # This line is not allowed to be changed as otherwise the built-in backup solution will not work
      - /var/run/docker.sock:/var/run/docker.sock:ro # May be changed on macOS, Windows or docker rootless. See the applicable documentation. If adjusting, don't forget to also set 'WATCHTOWER_DOCKER_SOCKET_PATH'!
      - ./abc:/mnt/ncdata2
    #network_mode: bridge # add to the same network as docker run would do
    networks:
      - nextcloud-aio
    ports:
      #- 80:80 # Can be removed when running behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else). See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
      #- 0.0.0.0:443:443
      #- 0.0.0.0:80:80
      - 0.0.0.0:8080:8080
      # - 8443:8443 # Can be removed when running behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else). See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
    environment: # Is needed when using any of the options below
      # AIO_DISABLE_BACKUP_SECTION: false # Setting this to true allows to hide the backup section in the AIO interface. See https://github.com/nextcloud/all-in-one#how-to-disable-the-backup-section

       APACHE_PORT: 11000 # Is needed when running behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else). See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
       #APACHE_IP_BINDING: 127.0.0.1 # Should be set when running behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else) that is running on the same host. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
       APACHE_IP_BINDING: 0.0.0.0 # Should be set when running behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else) that is running on the same host. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md

...
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions