Nextcloud fpm container with nginx on the host

Solution 1:

I know the question is pretty old, but since I ran into the same issue and couldn't find an answer anywhere, I leave my solution here for reference.

The problem is the different path to the files inside the docker container and on the host itself. In the php block of the nginx config $document_root points to /home/baptiste/nextcloud/data/nextcloud while php-fpm in the container can't access it as this path doesn't exist. There the path is /var/www/html. My solution was to replace $document_root with the path in the nextcloud container, /var/www/html.