The Nextcloud Quick reference on Docker Hub states that there are two versions (apache or fpm) of the Nextcloud image. The apache version contains a full Nextcloud installation including an apache web server. The fpm version must be combined with any webserver that can proxy the http requests to the FastCGI-port of the container.
In the Quick reference fpm example, an nginx container is combined with the Nextcloud-fpm image and a MariaDB database container. If you would rather use Caddy in place of nginx, below you will find an equivalent fpm example that replaces nginx with Caddy v2 as the webserver.
Although this topic is old, it is very relevant!
I am considering switching to Nextcloud-FPM (from FileRun) and switching to Caddy-docker-proxy (from Traefik) as I do everything with Docker Compose.
But I am just traumatised from spending months figuring out Traefik for all my stuff (mainly OpenOffice Documentserver was impossible to debug).
I understand Caddy (the docker-proxy version) can be as simple as adding 2 labels to your (Nextcloud) container, but the scenario of @basil needs Caddy to replace nginx as well, not just the reverse https proxy.
On top of that it needs to support Nextcloud FPM/fastcgi.
How to do that wil the caddy-docker-proxy version?
There’s nothing to stop you using the Apache or FPM (with nginx) examples as is in the Quick reference guide together with a Caddy container. There’s no compelling reason to replace nginx with Caddy in the FPM example, other than it’s one less container to deal with.
If you choose to replace nginx with Caddy in the FPM example, then I suspect all you need to do is add the reverse proxy construct to this example’s Caddyfile.
If you choose to use the unadulterated FPM/nginx or Apache examples from the quick reference guide, and use Caddy just for the reverse proxy function, there are a couple of extra lines that you will need to include along with the reverse proxy construct in the Caddyfile. Refer to the Case study: Variations in Caddyfile design for different Nextcloud builds for further clues.
Thanks for this
Works like a charm
It saved my sanity
New to self hosting and playing around with all kinds of 'ready 'nextcloud docker containers
LinuxUser,ownyourbits,official.
I have caddywebserver for reverse proxy and none of them worked
Cheers
Found this super useful! I am coming from podman and I’ve used the following set-up for local HTTPS using the nextcloud-fpm container. I’ve adapted your config based on my post in HTTPS on LAN - Access via different host.
Set-up a pod
podman pod create --name nextcloud -p 4080:80 -p 4443:443
CADDY DOCKER PROXY EXAMPLE Run Nextcloud with just a few labels, nothing else!
I managed to figure out how to get Nextcloud 21 working with an A+ security rating, with the fastest options possible. There are so many nextcloud+caddy examples out there, most don’t work, are outdated or only work in a specific environment. Also, none of them use the setup simplicity docker-compose offers with docker-caddy-proxy.
This version is for everyone and contains the basics you need for the fastest Nextcloud experience. :
Redis for caching
PostgreSQL as it is the fastest database
FPM version of Nextcloud
Caddy as both reverse proxy and webserver, no need for nginx
Note: I used Nextcloud for a few days and immediately switched back to FileRun.
If you do not need calendar/contacts and all those extras, FileRun is the way to go in my opinion. Nextcloud does not even come close in speed (even with all that effort, it is still a bit slow), usability, user friendly UI etc is just much better thought through with FileRun.
Also, Nextcloud lacks proper documentation on how to install it with the fastest components + get A+ rating. Since it took quite some effort, I am sharing it here, even though I stopped using it!
(note an updated version is on github, link below)