Nextcloud installation fails with Permission denied

Hi all,

I just installed Nextcloud using the guide Nextcloud setup on archlinux. I ran in an error, translated with deepl:

Internal server error The server could not complete the request.
...
Further details can be found in the server log.

The server log includes the following:

[ManjaroServer share]# tail /var/log/nextcloud/nextcloud.log
{"...method":"","url":"--","message":{"Exception":"Error","Message":"file_put_contents(/usr/share/webapps/nextcloud/.htaccess): 
Failed to open stream: Permission denied at **/usr/share/webapps/nextcloud/lib/private/Setup.php**#565","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"}, ...

The rights of the mentioned file are:

ls -al /usr/share/webapps/nextcloud/lib/private/Setup.php
-rw-r--r-- 1 root root 19480 24. Feb 00:04 /usr/share/webapps/nextcloud/lib/private/Setup.php

Should I chown this to the webserver? Or nextcloud-user? Which group? Only rigths?

Regards CJC

I tried a step further with

sudo chmod 777 /etc/webapps/nextcloud/config/config.php
sudo chmod 777 /etc/webapps/nextcloud/config
sudo chmod 777 /etc/webapps/nextcloud
sudo chmod 777 /var/lib/nextcloud
sudo chmod 777 /var/lib/nextcloud/data
sudo chmod 0777 /usr/share/webapps/nextcloud/apps
sudo systemctl restart httpd

and now the nextcloud says:

Writing to the "apps" directory is not possible

And now?

??
This seems to me a standard error, but in a new fresh installation weird. But threre are no standard means to avoid this error?

Regards

CJC

Maybe this will help: LINK