I try to switch completely from Nginx to Caddy, but, strange as it sounds, the net is full of examples for Caddyfiles for Nextcloud, but none of seem to be up to date.
My Nextcloud is in a subdirectory, bare metal, and using a custom built php-fpm container. This works perfectly with the Nginx (subdirectory!) example given in the official admin manual.
(So, no Nextcloud oder AIO container, only a PHP-FPM container. No, I don’t want to switch to an “official” container and/or dedicated domain, as this would mean to reconfigure all users.)
I especially tried the examples from this thread:
and from this abandoned pull request:
Nothing works, different errors occur (I tried too many variations to be able to quote them).
So a simple question: Has somebody a working setup with Caddy - bare metal Nextcloud in a subdirectory?
The pull request is a good starting point I think. There was some activity recently, and if you start from this example and there are problems, you can directly give feedback and we’ll end up having a working configuration for caddy as well.
The example from the pull request, did, however, not work, at least for my configuration in a subdirectory, and I’m not knowledgable enough in Caddy to fix it. As I interpreted the error, all works fine for static assets, but the path for PHP scripts is constructed wrongly.
Currently I ended up keeping Nginx running for the moment. And I’ll probably move Nextcloud from subdirectory to root directory (including re-configuring all clients), because in the end the subdirectory stuff only makes problems.