Installation fails on shared web host

Using uploaded setup-nextcloud.php to create installation on subdomain. Installation fails with"

client denied by server configuration: /var/www/vhosts/mydomain.co.uk/cloud.mydomain/data/htaccesstest.txt.

Subsequent attempts to login give: Internal Server error

The server was unable to complete your request.
If this happens again, please send the technical details below to the server administrator.
More details can be found in the server log.

Except there are no more details in the server logs for the subdomain.

Help please

Hello

If your hosted, this means you don’t have access to server folder /files. Ask for support.

If you fully manage your server/vm, then your config is bad.
Could be:

  • Right access to folder/files to be change with good ownership ( chmod/chown )
  • bad .htaccess config ( valid one below )
 # Generated by Nextcloud on 2021-05-09 17:56:46
# Section for Apache 2.4 to 2.6
<IfModule mod_authz_core.c>
  Require all denied
</IfModule>
<IfModule mod_access_compat.c>
  Order Allow,Deny
  Deny from all
  Satisfy All
</IfModule>

# Section for Apache 2.2
<IfModule !mod_authz_core.c>
  <IfModule !mod_access_compat.c>
    <IfModule mod_authz_host.c>
      Order Allow,Deny
      Deny from all
    </IfModule>
    Satisfy All
  </IfModule>
</IfModule>

# Section for Apache 2.2 to 2.6
<IfModule mod_autoindex.c>
  IndexIgnore *
</IfModule>
  • Bad Apache/Nginx config.
Thank you for the reply:
I tried your code in my subdomain .htaccess but it gave an internal server error 500. Here is the current code from the .htaccess in the subdomain where nextcloud has been installed:
<IfModule mod_headers.c>
   <IfModule mod_setenvif.c>
    <IfModule mod_fcgid.c>
       SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
       RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
    </IfModule>
    <IfModule mod_proxy_fcgi.c>
       SetEnvIfNoCase Authorization "(.+)" HTTP_AUTHORIZATION=$1
    </IfModule>
    <IfModule mod_lsapi.c>
      SetEnvIfNoCase ^Authorization$ "(.+)" XAUTHORIZATION=$1
      RequestHeader set XAuthorization %{XAUTHORIZATION}e env=XAUTHORIZATION
    </IfModule>
  </IfModule>
 
I also have another .htaccess file in a subfolder of the root directory which controls access to the software there. I added the following line before the RewriteBase command:

RewriteRule ^cloud.mydomain.co.uk/.*$ - [PT]

but that didn't work either.

For clarification purposes, I have a shopping cart installed in a subfolder of the main root directory with its own .htaccess file and a subdomain with the nextcloud installation.

Usually, on prod servers, the rewritte rules are served by the apache2 vhost conf

RewriteEngine on
    RewriteCond %{SERVER_NAME} =sub.domaine.ext # where sub.domain.ext is your server domain, added for privacy/exemple
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

Usually, on prod servers, the rewritte rules are served by the apache2 vhost conf

RewriteEngine on
    RewriteCond %{SERVER_NAME} =sub.domaine.ext # where sub.domain.ext is your server domain, added for privacy/exemple
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

my live examples:

There is a htaccess file in the actual data storage folder. I used datastore as the name instead of the default ‘data’. The htaccess file is the same as the one you suggested. I copied this file into the subdomain root and also later, in the nextcloud/data directory, but I couldn’t even access the server (503 error). It appears that it is looking for a file called htaccesstest.txt which isn’t there because it was never written by Nextcloud during installation, although there are other files in the directory which suggests that the permissions are correct. I have seen other reports but these are not with shared web hosting. The closest issue I can find is:

fyi The installation never finished and I deleted the subdomain/ database a few times and I still get this error.

Finally got it to work…
I selected datastore as the default data storage area instead of data. I noticed a huge log file in there…deleted it and tried to login again. The new nextcloud.log file had the following error message as the first line. I will only post part of it because it’s very long:
An exception occurred while executing a query: SQLSTATE[HY001]: Memory allocation error: 1038 Out of sort memory, consider increasing server sort buffer size"
It’s a nextcloud issue rather than permissions or htaccess misredirecion.
The first error message relates to an app in nextcloud called circles. I renamed the folder “circles” in the nextcloud/apps directory.
The login immediately worked and the installation finished. The correct .htaccess file (the same as the one you recommended) was installed in the datastore subdirectory.
This must be an issue for anyone using the 23.0.2 version on a hosted web site as it would be very difficult to change the php memory allocation parameters for most users.

Thank you for your help.