Nextcloud and Caddy

Hello, I want my nextcloud to be available only via LAN or VPN. So, I鈥檝e installed nextcloud aio and caddy via docker compose:

version: "3.8"

services:
  caddy:
    image: caddy:alpine
    restart: unless-stopped
    container_name: caddy
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile
      - ./certs:/certs
      - ./config:/config
      - ./data:/data
      - ./sites:/srv
    network_mode: "host"

  nextcloud:
    image: nextcloud/all-in-one:latest
    restart: unless-stopped
    container_name: nextcloud-aio-mastercontainer
    ports:
      - "8080:8080"
    environment:
      - APACHE_PORT=11000
      - NEXTCLOUD_DATADIR=/mnt/nas 
      - NEXTCLOUD_MOUNT=/mnt/
      - SKIP_DOMAIN_VALIDATION=true
    volumes:
      - nextcloud_aio_mastercontainer:/mnt/docker-aio-config
      - /var/run/docker.sock:/var/run/docker.sock:ro
    depends_on:
      - caddy

volumes:
  nextcloud_aio_mastercontainer:
    name: nextcloud_aio_mastercontainer

And here is my caddy file:

myname.ddns.net:443 {
    reverse_proxy localhost:11000
}

I鈥檝e opened port 80 on my router and always get a cert error, so I had to open 443 too. The main problem is that I can access my nextcloud from the Internet, but I want it to be accessible only from LAN. I鈥檝e read a million of times reverse-proxy and local-instance manuals and it didn鈥檛 help me to solve the problem

Hi, see https://github.com/nextcloud/all-in-one/blob/main/local-instance.md

Sry, but I鈥檝e read it really, I got it to work, but I can鈥檛 get why I have access from internet. If I close port 443 on my router I got SSL error

I鈥檝e added - APACHE_IP_BINDING=127.0.0.1 to docker-compose, but still got access from the Internet

This will be further answered in Nextcloud and Caddy 路 nextcloud/all-in-one 路 Discussion #4091 路 GitHub