What I do not understand about this example, is how does this redirect traffic to the nextcloud server? Where do I give it the IP address of the nextcloud server? Do I simply make a line like
proxy / 192.168.0.50 { }
If so, do I need any presets? It can’t be that easy, right?
The example Caddyfile you linked is for Caddy to serve Nextcloud directly as a local site from PHP files on disk.
If you’ve already got Nextcloud running and available on another machine, then… Yes! It’s that easy. I think Nextcloud uses websockets for some features, so I’d use that preset. Transparency is also useful.
With that proxy, Caddy will faithfully forward responses from Nextcloud to the connecting client. Unless you have misconfigured redir directives in your Caddyfile, there might be a problem with Nextcloud (perhaps it’s trying to canonically redirect, or go from HTTP->S?).
well, I tried it both as a directory and as a subdomain. Subdomain works
going to mydomain.com/nextcloud is giving me the too many redirects error
going to nextcloud.mydomain.com/nextcloud gives me the login page
I tried adding the without /nextcloud directive but that didn’t help me at all. I guess I can live with the extra nextcloud at the end because at least it’s working.
As for your questions: under mydomain.com I have several other proxies configured for other services I use. under nextcloud.mydomain.com I have just the nextcloud configuration.
regarding nextcloud configuration, I do have a cert installed on it from let’s encrypt, although HTTP is still open. I could research how to uninstall the cert and tell apache just to accept HTTP traffic. That should likely test the waters there, yes?
Looks like there’s no /nextcloud proxy under my.domain.com. Seems like your other proxy is aimed at a HTTP endpoint, though, so it can’t be a redirect loop for a HTTPS upgrade. Not sure, but there’s definitely no other redirects, so it’s strange for Nextcloud to be acting up.
As for the /nextcloud basepath on the nextcloud.mydomain.com site, there will possibly be a setting somewhere in Nextcloud itself. Or, it may simply be designed to use a subfolder that way.