Data directory outside web root - or not?


I understand that one should place the data directory outside of web root. And I tried to follow this advice when setting up NC (via docker-compose by specifying “~/nextcloud/data:/mnt/nextcloud-data” in the docker-compose file).

So I thought all is fine.

But then I saw that NC says in the Users view that my users’ storage location still is e.g. “/var/www/html/data/admin”.

So did something go wrong when I placed the data folder outside web root or is this how it should be (and the users’ storage location is okay to stay in web root)?


Just open /config/config.php and adjust the path

'datadirectory' => '/var/www/nextclo.ud/ncdata/',

I did change the line in config.php to point to where I placed my data folder in docker-compose.yml.

When I then tried to open “Files” in NC, I got an error that I need to have “.ocdata” in my data folder. So I copied over the entire contents (including .ocdata) of my old data folder to the new data folder.

Now I can open “Files” again.

But many of the installed apps throw an error when I try to open them, e.g. Photos, Talk, Mail, … The error says “The server was unable to complete your request.”. And the app store is gone completely.

Any idea how I can recover?


ahh, I may have found a solution:

chown -R www-data:www-data /mnt/nextcloud-data

Now the apps don’t throw an error anymore. Hoping that there a no other still hidden problems…