1. The problem I’m having:
I’m trying to set up my own NextCloud AIO on my home server and using Caddy as reverse proxy.
- I have the DynDNS domain name from my router (tp-link).
- I have Wireguard VPN set up with my home server as client and the router is my VPN server.
- I have my own domain and would like to use a subdomain (like nextcloud.mydomain.com) as I already have another server with different IP pointing to the main base domain.
- I’ve opened the two ports Caddy’s documentation say to port-forward in my router. It gives me the option to choose to which device so they only access my server through the VPN
Currently I have my subdomain A record pointing to the endpoint of my VPN client on the home server, but that doesn’t seem to be it.
2. Error messages and/or full log output:
Yesterday when I ran docker compose up Caddy said it couldn’t find valid A records. Today (without me having changed anything other than restarting my server) it’s saying connection refused, it seems to be trying to read the local host IP..
"level":"error", "ts":1794347032.643504", "logger":"tls.obtain","msg":"will retry","error":"[``mysubdomain.mydomain.com``] Obtain: [``mysubdomain.mydomain.com``] creating new order: provisioning client: performing request: Get \"``https://acme-staging-v02.api.letsenctrypt.org/directory\``": dial tcp: lookup ``acme-staging-v02.api.letsencrypt.org`` on 127.0.0.53:53: read udp 127.0.0.1:55776 -> 127.0.0.53:53: read connection refused (ca=https://acme-staging-v02.api.letsencrypt.org/directory)"
3. Caddy version:
v2.11.9
4. How I installed and ran Caddy:
Through docker compose and it’s also installed in my system through sudo apt install caddy
a. System environment:
Ubuntu 26.04.1 LTS (Ubuntu Server)
b. Command:
docker compose up
c. Service/unit/compose file:
name: nextcloud-aio # Add the container to the same compose project to which all the sibling containers are added automatically
services:
caddy:
image: caddy:alpine
restart: unless-stopped
container_name: caddy
cap_add:
- NET_ADMIN
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- caddy_config:/config
- caddy_data:/data
networks:
- proxy
volumes: # If you want to store the data on a different drive, see https://github.com/nextcloud/all-in-one#how-to-store-the-filesinstallation-on-a-separate-drive
nextcloud_aio_mastercontainer:
name: nextcloud_aio_mastercontainer # This line is not allowed to be changed as otherwise the built-in backup solution will not work
caddy_config:
caddy_data:
networks:
proxy:
external: true
In this same yaml there’s the stuff for NextCloud but that’s running well and is not relevant for this
d. My complete Caddy config:
{
# Set this path to your site's directory
root * /usr/share/caddy
# Enable the static file server
file_server
}
https://subdomain.domain.com:443 {
header {
Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
X-Content-Type-Options "nosniff"
Referrer-Policy "strict-origin-when-cross-origin"
-Server
}
reverse_proxy localhost:11000
}
5. Links to relevant resources:
Type here