Desktop client "/nextcloud/status.php - 404 not found"

Nextcloud version: 27.0.2
Operating system and version: Docker on Debian GNU/Linux 11 (bullseye)
Apache or nginx version: Apache docker image (27)

The issue you are facing:
When I use the desktop client to sync, I get the error that the client can’t connect because /nextcloud/status.php can’t be found.
The web interface and the mobile apps are working fine without any problems. I tried the desktop client on Windows and Mac, but both don’t work.

My setup is running behind a Traefik proxy inside of docker. The desktop client worked some time ago, but I’m not sure if it stopped working with version 26 or 27. I have this problem for some time now and tried to solve it, but couldn’t.

I also tried to create a fresh installtion, but I have the same problem, the only difference is, that on the fresh installation when I open <Domain>/nextcloud/status.php I see a 404 error page from nextcloud, but on the old installtion I see a 404 error page from apache.

Is this the first time you’ve seen this error?: Yes

Steps to replicate it:

  1. Use this docker-compose file
version: "3.8"

services:
  nextcloud-database:
    image: mariadb:10.9
    container_name: nextcloud-database
    hostname: nextcloud-database
    environment:
      MYSQL_ROOT_PASSWORD: ${DATABASE_ROOT_PASSWORD}
      MYSQL_USER: ${DATABASE_USER}
      MYSQL_PASSWORD: ${DATABASE_PASSWORD}
      MYSQL_DATABASE: ${DATABASE_NAME}
    volumes:
    - "/opt/nextcloud/database:/var/lib/mysql"
    networks:
    - nextcloud
    
  nextcloud-redis:
    image: redis:alpine
    container_name: nextcloud-redis
    hostname: nextcloud-redis
    restart: on-failure:6
    command: redis-server --requirepass ${REDIS_PASSWORD}
    networks:
    - nextcloud
    
  nextcloud-app:
    image: nextcloud:27-apache
    container_name: nextcloud
    restart: on-failure:3
    depends_on:
    - nextcloud-database
    - nextcloud-redis
    labels:
    - "traefik.enable=true"
    - "traefik.network=traefik"

    - "traefik.http.routers.nextcloud-https.rule=Host(`<Domain>`)"
    - "traefik.http.routers.nextcloud-https.entrypoints=https"
    - "traefik.http.routers.nextcloud-https.middlewares=nextcloud, redirect-to-dav, nextcloud-buffer"
    - "traefik.http.routers.nextcloud-https.service=nextcloud"
    
    - "traefik.http.routers.nextcloud-https.tls=true"
    
    - "traefik.http.middlewares.nextcloud.headers.hostsProxyHeaders=X-Forwarded-Host"
    - "traefik.http.middlewares.nextcloud.headers.referrerPolicy=same-origin"
    - "traefik.http.middlewares.nextcloud.headers.stsSeconds=15552000"

    - "traefik.http.middlewares.redirect-to-dav.redirectRegex.permanent=true"
    - "traefik.http.middlewares.redirect-to-dav.redirectRegex.regex=https://(.*)/.well-known/(card|cal)dav"
    - "traefik.http.middlewares.redirect-to-dav.redirectRegex.replacement=https://$${1}/remote.php/dav/"
    
    - "traefik.http.middlewares.nextcloud-buffer.buffering.maxRequestBodyBytes=6442450944"

    - "traefik.http.services.nextcloud.loadbalancer.server.port=80"
    environment:
      # Database
      MYSQL_HOST: ${DATABASE_HOST}
      MYSQL_USER: ${DATABASE_USER}
      MYSQL_PASSWORD: ${DATABASE_PASSWORD}
      MYSQL_DATABASE: ${DATABASE_NAME}
      # Apache
      APACHE_DISABLE_REWRITE_IP: 1
      TRUSTED_PROXIES: ${PROXY}
      TRUSTED_DOMAINS: ${TRUSTED_DOMAINS}
      # Overwrites
      OVERWRITECLIURL: ${OVERWRITECLIURL}
      OVERWRITEHOST: ${OVERWRITEHOST}
      OVERWRITEPROTOCOL: https
      # Redis
      REDIS_HOST: ${REDIS_HOST}
      REDIS_HOST_PASSWORD: ${REDIS_PASSWORD}
      # PHP Setting
      PHP_MEMORY_LIMIT: ${PHP_MEMORY_LIMIT}
      PHP_UPLOAD_LIMIT: ${PHP_UPLOAD_LIMIT}
    volumes:
    - "/opt/nextcloud/data:/var/www/html/data"
    - "/opt/nextcloud/config:/var/www/html/config"
    - "/opt/nextcloud/apps:/var/www/html/custom_apps"
    - type: tmpfs
      target: /tmp
    networks:
    - nextcloud
    - traefik

networks:
  nextcloud:
  traefik:
    external: true

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'trusted_proxies' =>
  array (
    0 => '172.19.0.0/16',
  ),
  'instanceid' => '...',
  'passwordsalt' => '...',
  'secret' => '...',
  'trusted_domains' =>
  array (
    0 => '...',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '27.0.2.1',
  'dbname' => 'nextcloud',
  'dbhost' => 'nextcloud-database:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '...',
  'installed' => true,
  'default_phone_region' => 'DE',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'nextcloud-redis',
    'password' => '...',
    'port' => 6379,
  ),
  'mail_from_address' => 'no-reply',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => '...',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtphost' => '...',
  'mail_smtpport' => '465',
  'mail_smtpsecure' => 'ssl',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'no-reply@...',
  'mail_smtppassword' => '...',
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' =>
  array (
  ),
  'twofactor_enforced_excluded_groups' =>
  array (
  ),
  'maintenance' => false,
  'loglevel' => 2,
  'theme' => '',
);

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.
Error Logs

The status.php file should be in the root of your nextcloud instance. Did you check it is present and has the same access privileges as the other files there? All files should be owned by www-data, or whatever user you configured to run the instance.

Is this in a LAN or on an internet server? What URL are you using to access the instance?

In the folder /var/www/html is a file called status.php with the following rights
-rw-r--r-- 1 www-data www-data 2452 Aug 22 18:40 status.php

This is the content of status.php

<?php
/**
 * @copyright Copyright (c) 2016, ownCloud, Inc.
 *
 * @author Andreas Fischer <bantu@owncloud.com>
 * @author Christopher Schäpers <kondou@ts.unde.re>
 * @author Christoph Wurst <christoph@winzerhof-wurst.at>
 * @author Frank Karlitschek <frank@karlitschek.de>
 * @author Joas Schilling <coding@schilljs.com>
 * @author Jörn Friedrich Dreyer <jfd@butonic.de>
 * @author Julius Härtl <jus@bitgrid.net>
 * @author Kristof Provost <github@sigsegv.be>
 * @author Lukas Reschke <lukas@statuscode.ch>
 * @author martin.mattel@diemattels.at <martin.mattel@diemattels.at>
 * @author Masaki Kawabata Neto <masaki.kawabata@gmail.com>
 * @author Morris Jobke <hey@morrisjobke.de>
 * @author Roeland Jago Douma <roeland@famdouma.nl>
 *
 * @license AGPL-3.0
 *
 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License, version 3,
 * along with this program. If not, see <http://www.gnu.org/licenses/>
 *
 */
require_once __DIR__ . '/lib/versioncheck.php';

try {
        require_once __DIR__ . '/lib/base.php';

        $systemConfig = \OC::$server->getSystemConfig();

        $installed = (bool) $systemConfig->getValue('installed', false);
        $maintenance = (bool) $systemConfig->getValue('maintenance', false);
        # see core/lib/private/legacy/defaults.php and core/themes/example/defaults.php
        # for description and defaults
        $defaults = new \OCP\Defaults();
        $values = [
                'installed' => $installed,
                'maintenance' => $maintenance,
                'needsDbUpgrade' => \OCP\Util::needUpgrade(),
                'version' => implode('.', \OCP\Util::getVersion()),
                'versionstring' => OC_Util::getVersionString(),
                'edition' => '',
                'productname' => $defaults->getProductName(),
                'extendedSupport' => \OCP\Util::hasExtendedSupport()
        ];
        if (OC::$CLI) {
                print_r($values);
        } else {
                header('Access-Control-Allow-Origin: *');
                header('Content-Type: application/json');
                echo json_encode($values);
        }
} catch (Exception $ex) {
        http_response_code(500);
        \OC::$server->getLogger()->logException($ex, ['app' => 'remote']);
}

The nextcloud instance is reachable on the internet under https://cloud.<My Domain>/ but the client tries to reach the status.php file under https://cloud.<My Domain>/nextcloud/status.php

So you have to check your webserver configuration.

Are the nextcloud files all under /var/www/html, or under /var/www/html/nextcloud? If there is a html/nextcloud directory, should the status.php be moved there? Is the client configured with the same URL that can be reached via the browser?

All files are under /var/www/html

The .htaccess file

www-data@6093b5707375:~/html$ cat .htaccess
<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>

  <IfModule mod_env.c>
    # Add security and privacy related headers

    # Avoid doubled headers by unsetting headers in "onsuccess" table,
    # then add headers to "always" table: https://github.com/nextcloud/server/pull/19002
    Header onsuccess unset Referrer-Policy
    Header always set Referrer-Policy "no-referrer"

    Header onsuccess unset X-Content-Type-Options
    Header always set X-Content-Type-Options "nosniff"

    Header onsuccess unset X-Frame-Options
    Header always set X-Frame-Options "SAMEORIGIN"

    Header onsuccess unset X-Permitted-Cross-Domain-Policies
    Header always set X-Permitted-Cross-Domain-Policies "none"

    Header onsuccess unset X-Robots-Tag
    Header always set X-Robots-Tag "noindex, nofollow"

    Header onsuccess unset X-XSS-Protection
    Header always set X-XSS-Protection "1; mode=block"

    SetEnv modHeadersAvailable true
  </IfModule>

  # Add cache control for static resources
  <FilesMatch "\.(css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite)$">
    <If "%{QUERY_STRING} =~ /(^|&)v=/">
      Header set Cache-Control "max-age=15778463, immutable"
    </If>
    <Else>
      Header set Cache-Control "max-age=15778463"
    </Else>
  </FilesMatch>

  # Let browsers cache WOFF files for a week
  <FilesMatch "\.woff2?$">
    Header set Cache-Control "max-age=604800"
  </FilesMatch>
</IfModule>

<IfModule mod_php.c>
  php_value mbstring.func_overload 0
  php_value default_charset 'UTF-8'
  php_value output_buffering 0
  <IfModule mod_env.c>
    SetEnv htaccessWorking true
  </IfModule>
</IfModule>

<IfModule mod_mime.c>
  AddType image/svg+xml svg svgz
  AddType application/wasm wasm
  AddEncoding gzip svgz
  # Serve ESM javascript files (.mjs) with correct mime type
  AddType text/javascript js mjs
</IfModule>

<IfModule mod_dir.c>
  DirectoryIndex index.php index.html
</IfModule>

<IfModule pagespeed_module>
  ModPagespeed Off
</IfModule>

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTP_USER_AGENT} DavClnt
  RewriteRule ^$ /remote.php/webdav/ [L,R=302]
  RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L]
  RewriteRule ^remote/(.*) remote.php [QSA,L]
  RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
  RewriteRule ^\.well-known/(?!acme-challenge|pki-validation) /index.php [QSA,L]
  RewriteRule ^(?:\.(?!well-known)|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>

AddDefaultCharset utf-8
Options -Indexes

The apache sites-enabled file 000-default.conf

www-data@6093b5707375:~/html$ cat /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80>
	# The ServerName directive sets the request scheme, hostname and port that
	# the server uses to identify itself. This is used when creating
	# redirection URLs. In the context of virtual hosts, the ServerName
	# specifies what hostname must appear in the request's Host: header to
	# match this virtual host. For the default virtual host (this file) this
	# value is not decisive as it is used as a last resort host regardless.
	# However, you must set it for any further virtual host explicitly.
	#ServerName www.example.com

	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/html

	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:warn

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

I use in the client the same URL which I use to open the Nextcloud in the browser.

I use the official docker image and didn’t change what is not configured in the docker-compose file in my earlier post. Everything else should be found here:

I have this additional section in my apache config file (in sites-available), adapted to your settings:

        <Directory /var/www/html> 

                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Require all granted

                SetEnv HOME /var/www/html
                SetEnv HTTP_HOME /var/www/html

                <IfModule mod_dav.c>
                        Dav off
                </IfModule>
                
        </Directory>

Note: you should not have editable files in sites-enabled. The files should be in sites-available and then activated by a2ensite. This will create a symlink in sites-enabled to sites-available.

I never changed the apache config that is default to the docker image. I tried to add the Directory block to the apache config, but the problem still presists.