What permissions does Nextcloud need and on what directories?

Nextcloud version _ 16.0.4
Operating system and version (eg, Ubuntu 17.04): Manjaro 4.19
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.41
PHP version (eg, 7.1): 7.3.9

The issue you are facing:

I’ve set up Nextcloud using Apache on my PC, when I go to Localhost, the Nextcloud page comes up with ‘Internal Server Error’

I can’t make sense of the error codes, and I’ve posted them twice here already without any answer, so I presume no-one else can make sense of them either (which isn’t a good sign).

But I don’t want to just give up, having got this far, so I’m trying a different tack. The first error code says something about permissions being denied. I want to know how to check whether I’ve got the file permissions right. What user:group runs Nextcloud - is it just the webserver or a new group? What directories will this user:group need access to and what access rights does it need?

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Install Nextcloud with Apache
  2. Go to LocalHost

The output of your Apache/nginx/system log in /var/log/____:

PHP Warning:  fileperms(): stat failed for /usr/share/webapps/nextcloud/data/nextcloud.log in /usr/share/webapps/nextcloud/lib/private/Log/File.php on line 140

touch(): Unable to create file \\/usr\\/share\\/webapps\\/nextcloud\\/config\\/config.php because Permission denied at \\/usr\\/share\\/webapps\\/nextcloud\\/lib\\/private\\/Config.php#240","userAgent":"Mozilla\\/5.0 (X11; Linux x86_64; rv:69.0) Gecko\\/20100101 Firefox\\/69.0","version":""}

The Nextcloud web files, and the data folder, should be owned by the account used to run the web server (e.g. www-data on Ubuntu).

Thanks, where are the Nextcloud web files and the data folder?

I have /usr/share/webapps/nextcloud (where Nextcloud is) and /srv/http (where Apache serves pages from) and /home/{me}/public_html from where Apache serves local pages.

my http-web group has full access to all of them (and execute access to parent directories).

Are there other directories it needs access to? If not, why am I getting fileperms errors?

According to your logs you have the wrong permissionon /usr/share/webapps/nextcloud as it cant write to the config dir in that folder or the data dir of that folder.

the owner and group should be the same as the webserver and php has. That folder in your logs has the data dir and the web folder. If you check the apache config.

If you are running on an rpm based linux distribution you might have selinux that prohibits write to that folder and in that case you need to add an selinux policy that will allow that folder to be used.