1: Make sure the proper .htaccess file is in the data directory. The web server needs to be configured to allow the listed commands to work.
Here is an example .htaccess
# Generated by ownCloud on 2016-11-16 13:56:06
# line below if for Apache 2.4
<ifModule mod_authz_core.c>
Require all denied
</ifModule>
# line below if for Apache 2.2
<ifModule !mod_authz_core.c>
deny from all
Satisfy All
</ifModule>
# section for Apache 2.2 and 2.4
IndexIgnore *
2: Even with the .htaccess file, it’s better to have your data directory located in a place that is not publicly served by Apache.
That is the .htaccess for the default Nextcloud root. There is a different .htaccess in the data directory, or at least there should be. I suggest downloading a fresh copy of Nextcloud, and extracting the .htaccess file from the data folder. Place that .htaccess in your data folder on the server.
I mean the data folder should not be served out directly by the web server. Here is an example.
Lets say your Nextcloud installation is located at /var/www/nextcloud. In a default setup, the data folder would then be at /var/www/nextcloud/data. But you can set your data folder to be at /var/www/data or any other non public path instead. That way the data folder is not available directly through the webserver. Just be sure that Nextcloud is able to access the new data folder location.
Instructions for moving the data folder can be found on these forums. Note, moving it is not supported after installation, but it should work. If this is a new install, you can do a reinstall and select an alternative data location during the setup.
Thank you very much for your help.
I “uninstalled” nextcloud and installed it again with the new data folder /var/www/nextclouddata and the error is done
I have now just one issue with the mem cache, but for that I will search at first
"OC\HintException: Memcache \OC\Memcache\APC not available for local cache at /var/www/nextcloud"
I was able to fix this issue by moving data directory to upper level to /var/www/data and changing /var/www/nextcloud/config/config.php line to 'datadirectory' => '/var/www/data',