[nextcloud] Missing icons with Caddy

Hi,

I’m trying to use Nextcloud-29 with Caddy on my server.

Nextcloud is working, but the icons on the dashboards for the extra apps are missing:
GET https:///nix-apps/contacts/img/app.svg 404 (Not Found)

My Nextcloud config is very basic, so I suspect it’s my Caddy config:

  services.caddy = {
    enable = true;
    virtualHosts = {
      "${config.services.nextcloud.hostName}".extraConfig = ''
        root * ${config.services.nextcloud.package}
        root /store-apps/* ${config.services.nextcloud.home}
        root /nix-apps/* ${config.services.nextcloud.home}

        php_fastcgi unix/${config.services.phpfpm.pools.nextcloud.socket}

        redir /.well-known/carddav /remote.php/dav/ 301
        redir /.well-known/caldav /remote.php/dav/ 301

        # Deny access to sensible files and directories
        @forbidden {
          path /build/* /tests/* /config/* /lib/* /3rdparty/* /templates/* /data/*
          path /.* /autotest* /occ* /issue* /indie* /db_* /console*
          not path /.well-known/*
        }
        error @forbidden 404

        file_server

        request_body {
          max_size 2GB
        }
      '';
    };
  };

Do you have any idea?

That is not correct. You need to target the output of webroot nixpkgs/nixos/modules/services/web-apps/nextcloud.nix at 0fbeef35a770cf6ad499539d2685e5b708c29847 · NixOS/nixpkgs · GitHub most likely with nixpkgs/nixos/modules/services/web-apps/nextcloud.nix at 0fbeef35a770cf6ad499539d2685e5b708c29847 · NixOS/nixpkgs · GitHub

The easiest is probably to just use nginx. Nextcloud is rather complex and requires many rules to work.

1 Like

Thank you, that was helpful! I had to find some examples, of how to refer to the webroot. :slight_smile:

I’m using the following value for nix-apps, and everything seems to be working fine:
${config.services.nginx.virtualHosts."${config.services.nextcloud.hostName}".root}

In many examples, I noticed ${config.services.nextcloud.home} being used with version 29. I’m curious if it’s still working for others with legacy configuration because of leftover files after the upgrade.

I made a extra module which adds extra options to the Nextcloud service, for example using the web server Caddy Nextcloud - NixOS Wiki
Give it a try :slight_smile:

Thank you, I will definitely give it a try! I’m trying to use the onlyoffice service together with this nextcloud+caddy combo, and it’s also not so simple…

Still running into the same problem, no icons. I tried using @onny 's module, but that doesn’t seem to make a difference. Did you ever find a solution to this?