I’m neither a Yunohost user, nor an nginx user, so don’t take this as gospel.
Did you confirm the user/group that nginx runs as (e.g., phpinfo)? Check again, in case Yunohost has weird settings – don’t presume that it’s www-data/www-data.
To set sane permissions and ownership from cli, as root, cd
to the root directory of your nextcloud and use:
find . -type f -exec chmod 644 {} \;
find . -type d -exec chown www-data:www-data {} \;
find . -type f -exec chown www-data:www-data {} \;```
Substitute your actual nginx user:group for www-data:www-data.
You may need to change /data too, but this should get it working again.