Nextcloud with Caddy v2 shows no content

Hi there!

I am trying to migrate a Nextcloud instance (NC 26.0.9, Debian 11 VM, Caddy v2, php8.1, mariadb, bare metal install) to a new VM (NC 26.0.9, Debian 12, Caddy v2, php8.2, mariadb) due to more storage need. No Docker.

The old instance runs smoothly since 2+ yrs with Caddy v2 as weberver.

I copied the Nextcloud and Data folder via rsync to the new VM and set up php8.2, redis according to C. Riegers great Howto (which I already used for the old working instance) except the nginx/acme stuff.

I installed Caddy v2 via the Caddy-Repo as a service and added the caddy user to the www-data and redis groups.

My Caddyfile looks like this:

my.domain.lol {
root * /var/www/nextcloud
file_server
encode gzip zstd

     php_fastcgi unix//run/php/php8.2-fpm.sock {
            env front_controller_active true
            trusted_proxies 127.0.0.1/8 ::1 xxx.xxx.xxx.xxx
    }

    # High Performance Backend / Client Push App
    handle_path /push/* {
            reverse_proxy http://127.0.0.1:7867
    }

    log {
            output file     /var/log/caddy/nextcloud.log
    }

    header {
            Strict-Transport-Security max-age=31536000;
            X-Download-Options noopen
    }

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

    # .htaccess / data / config / ... shouldn't be accessible from outside
    @forbidden {
            path    /.htaccess
            path    /data/*
            path    /config/*
            path    /db_structure
            path    /.xml
            path    /README
            path    /3rdparty/*
            path    /lib/*
            path    /templates/*
            path    /occ
            path    /console.php
    }

    respond @forbidden 404

}

So nothing special. As I said: This config runs smoothly on the old server since yrs.

I adjusted file/ folder permissions of the Nextcloud folder and Nextcloud Data folder to 660/770. PHP8.2-fpm is running as www-data with 660 permissions of the socket. Redis is configured with 770 permissions.

I can now login to my Nextcloud accounts but see no content. No files, contacts, calendar data. Just 2 hints in the UI: “Operation not permitted” and List of external endpoints can not be received:"

Obviously this points to a permission problem. But I am stuck at figuring out what is missing which permissions…?!

Logs (NC loglevel 0) don’t give a useful hint. Very few entries, nothing related to permissions…

When I refresh the nextcloud files page these 2 entries are going to the nextcloud.log:

{“reqId”:“5alyuBSz00huJEG607ma”,“level”:1,“time”:“2023-11-28T15:59:32+01:00”,“remoteAddr”:“94.229.144.76”,“user”:“ncadmin”,“app”:“no app in context”,“method”:“GET”,“url”:“/apps/files/”,“message”:“Deprecated event type for \OCP\Collaboration\Resources::loadAdditionalScripts: null”,“userAgent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36”,“version”:“26.0.9.1”,“data”:}
{“reqId”:“5alyuBSz00huJEG607ma”,“level”:1,“time”:“2023-11-28T15:59:32+01:00”,“remoteAddr”:“94.229.144.76”,“user”:“ncadmin”,“app”:“no app in context”,“method”:“GET”,“url”:“/apps/files/”,“message”:“Deprecated event type for OCA\Files::loadAdditionalScripts: Symfony\Component\EventDispatcher\GenericEvent is used”,“userAgent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36”,“version”:“26.0.9.1”,“data”:}

No improvement if I run caddy as the www-data user.

(When I remove Caddy, install nginx and configure it according to the above mentioned Howto everything is working perfectly! So I think the php, redis and database part is configured correctly.)

Anyone can give me a hint on what I could be missing here?
Thanks in advance.

Just for the record:

For a proper install with Caddy v2 as frontend just don’t change the
‘cgi.fix_pathinfo’ variable in “/etc/php/8.2/fpm/php.ini”.

Leave it on default. If you change the value to “1” you will be left with a non-functional instance like described above with no useful debug information.

Solved.

1 Like