Nextcloud with Caddy on NixOS

1. Caddy version (caddy version):

2.4.6

2. How I run Caddy:

a. System environment:

NixOS 21.11

b. Command:

# systemctl cat caddy |grep ExecStart
ExecStart=/nix/store/5wa12j3rfb2g12ng1nlk6aqsyzsfq0n8-caddy-2.4.6/bin/caddy run  --config /nix/store/y31wwj8dssn09rrffy01p6b2zd4jalr1-caddy-config.json

d. My complete Caddyfile or JSON config:

# nix generates config.json from
services.caddy = {
  enable = true;
  virtualHosts = {
    "$fqdn" = {
      reverse_proxy /* 127.0.0.1:8080 # this is just an example
    };
  };
};

3. The problem I’m having:

I’m having trouble translating all of the relevant nginx config to caddyfile config.

4. Error messages and/or full log output:

No real error messages. Store installed apps don’t really work.

5. What I already tried:

root * ${config.services.nextcloud.package}
file_server

php_fastcgi unix//run/phpfpm/nextcloud.sock {
  env front_controller_active true
}

6. Links to relevant resources:

The part which would generate an suitable nginx config:

You can find an example config for Nextcloud here:

@francislavoie Thank you for the suggestion, but I’m looking for a solution without docker as the nextcloud + nginx combo I’m comparing to doesn’t use docker either.

I was pointing to that for the Caddyfile config described there, not for the fact it’s in Docker.

Right. But as you can see the NixOS nginx configuration has a few special things that I’m unsure of how to express in a caddyfile.

My point is I don’t think the extra stuff from the nginx config is necessary.

But it’s best if you try to convert it yourself, then ask for help specifically about the points you’re unsure about.

I’ve already tried, didn’t work. I left out the forbidden -stuff for brevity, since it hardly improves stuff working.

Did you solve your problem (@ptman) eventually?
If not, I think I might be able to help you with Caddy+NixOS (as a NixOS user) :slight_smile:

This topic was automatically closed after 30 days. New replies are no longer allowed.