Nextcloud version: 21.0.0.8
Operating system and version: Debian GNU/Linux 9
Apache or nginx version: Apache/2.4.25
PHP version: 7.4
I organise most of my projects in a way that redirects the requests internally to a given domain if it matches a folder in /var/www
. This works well with many other projects.
See folder structure
/var/www
/domain.com
/project1.domain.com
/project2.domain.com
(...)
/cloud.domain.com <- this is my NextCloud installation
.htaccess
See .htaccess structure
Options -Indexes -MultiViews +FollowSymLinks
# redirect IP access to domain.com
RewriteCond %{HTTP_HOST} ^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$
RewriteRule (.*) https://domain.com [R=301,L]
# remove trailing www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
# redirect http to https
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
# redirect subdomain to folder if exists
RewriteCond %{ENV:PREPENDED} !=1
RewriteCond %{ENV:REDIRECT_PREPENDED} !=1
RewriteCond %{ENV:REDIRECT_STATUS} !^30
RewriteCond /var/www/%{HTTP_HOST} -d
RewriteRule ^ /var/www/%{HTTP_HOST}%{REQUEST_URI} [E=PREPENDED:1]
However, when I do this for NextCloud, accessing to cloud.domain.com raises an internal server error that says “The server was unable to complete your request.”. When looking at the data/nextcloud.log file I find an error in lib/private/AppFramework/Http/Request.php
with the message The requested uri(/) cannot be processed by the script '/cloud.domain.com/index.php')
.
However, I’m still able to use NextCloud normally from the address https://cloud.domain.com/cloud.domain.com/index.php
. How could I fix it so that I can access without having a double URL? I’ve already tried to play with overwrite.cli.url
, overwritehost
and overwritewebroot
with no success.
Is this the first time you’ve seen this error?: yes
Steps to replicate it:
- Recreate my folder structure and .htaccess on a fresh Debian 9 install
- Install nextcloud on /var/www/cloud.domain.com
- Try to access cloud.domain.com
The output of your Nextcloud log in Admin > Logging:
Exception: The requested uri(/) cannot be processed by the script '/cloud.stargazr.ai/index.php')
The output of your config.php file in /path/to/nextcloud
(make sure you remove any identifiable information!):
Details
<?php
$CONFIG = array (
'instanceid' => '*******',
'passwordsalt' => '******',
'secret' => '*******',
'trusted_domains' =>
array (
0 => 'cloud.domain.com',
),
'datadirectory' => '/var/www/cloud.domain.com/data',
'dbtype' => 'mysql',
'version' => '21.0.0.18',
'dbname' => 'nextcloud',
'dbhost' => 'localhost:3306',
'dbport' => '',
'dbtableprefix' => 'oc_',
'dbuser' => 'oc_admin',
'dbpassword' => '*******',
'installed' => true,
'maintenance' => false,
'mysql.utf8mb4' => true,
'overwrite.cli.url' => 'https://cloud.domain.com'
);
The output of your Apache/nginx/system log in /var/log/____
: no data is logged at either access.log or error.log.