I’m in the process of setting up Nextcloud using this guide.
I have it partially working.
my internal domain is something like “example.house” and my external domain is “example.com”
I had already had my caddyfile set up for internal certs using Hetzner DNS challenges which works great. Now I’m adding a section at the top to handle the above situation (not docker, just a debian 11 VM running on the network).
Caddy file on internet accessible machine looks like this:
caddy.example.house {
acme_server
tls internal
}
nextcloud.example.com {
reverse_proxy https://nextcloud.example.house {
header_up Host {http.reverse_proxy.upstream.hostport}
header_up X-Forwarded-Host {host}
}
}
#.... (more configured sites) ...
server.example.house {
# acme_server
reverse_proxy localhost
tls {
issuer acme {
dns hetzner sEcReTcHaRaCtErS
resolvers 8.8.8.8 8.8.4.4
}
}
}
Caddyfile on the nextcloud installation looks like this:
{
# debug
acme_ca https://caddy.example.house/acme/local/directory
acme_ca_root /etc/ssl/certs/root.crt
}
nextcloud.example.house {
# tls {
# ca https://caddy.example.house/acme/local/directory
# ca_root /etc/ssl/certs/root.crt
# }
root * /var/www/nextcloud
file_server
log {
output file /var/log/caddy/nextcloud.log
format single_field common_log
}
php_fastcgi 127.0.0.1:9000 {
env PATH /bin
}
header {
# enable HSTS
Strict-Transport-Security max-age=31536000;
}
redir /.well-known/carddav /remote.php/dav 301
redir /.well-known/caldav /remote.php/dav 301
# .htaccess / data / config / ... shouldn't be accessible from outside
@forbidden {
path /.htaccess
path /data/*
path /config/*
path /db_structure
path /.xml
path /README
path /3rdparty/*
path /lib/*
path /templates/*
path /occ
path /console.php
}
respond @forbidden 404
}
And it works for the nextcloud.example.house domain (not HTTPS though)
but it does NOT work for the nextcloud.example.com case. The location bar changes to the local IP address (accessed internally) and I get a sadface page error that
this site can’t provide a secure connection.
Caddy log on the backend (nextcloud machine) shows:
{"level":"info","ts":1642718060.4591007,"msg":"serving initial configuration"}
What am I missing?