Cannot resolve well-known URL issues reported on Overview page in 18.0.1

Nextcloud version (eg, 12.0.2): 18.0.1
Operating system and version (eg, Ubuntu 17.04): Ubuntu 18.04
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.29
PHP version (eg, 7.1): PHP 7.2.24-0ubuntu0.18.04.3

The issue you are facing:
The “Overview” page is reporting that the web server is not properly set up to resolve “/.well-known/caldav” and “/.well-known/carddav”

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

Steps to replicate it:

  1. Set up clean Ubuntu 18.04 server
  2. Follow instructions in https://docs.nextcloud.com/server/18/admin_manual/installation/example_ubuntu.html
  3. Follow instructions in https://docs.nextcloud.com/server/18/admin_manual/issues/general_troubleshooting.html#service-discovery to add .htaccess file to the Apache root.

The output of your Nextcloud log in Admin > Logging:

There is nothing in the logs.

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

<?php
$CONFIG = array (
  'instanceid' => '<REDACTED>',
  'passwordsalt' => '<REDACTED>',
  'secret' => '<REDACTED>',
  'trusted_domains' =>
  array (
    0 => '<REDACTED>',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '18.0.1.3',
  'overwrite.cli.url' => '<REDACTED>',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '<REDACTED>',
  'dbpassword' => '<REDACTED>',
  'installed' => true,
  'maintenance' => false,
  'mysql.utf8mb4' => true,
);

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

[Wed Mar 04 15:07:41.605435 2020] [access_compat:error] [pid 26753] [client <REDACTED>] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata
<REDACTED> - - [04/Mar/2020:15:07:38 +0000] "GET /nextcloud/ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 1308 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4056.0 Safari/537.36 Edg/82.0.432.3"
<REDACTED> - - [04/Mar/2020:15:07:40 +0000] "GET /nextcloud/index.php/settings/admin/overview HTTP/1.1" 200 5345 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4056.0 Safari/537.36 Edg/82.0.432.3"
<REDACTED> - - [04/Mar/2020:15:07:41 +0000] "GET /nextcloud/index.php/core/js/oc.js?v=006851f8 HTTP/1.1" 200 7805 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4056.0 Safari/537.36 Edg/82.0.432.3"
<REDACTED> - - [04/Mar/2020:15:07:41 +0000] "GET /nextcloud/ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 1307 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4056.0 Safari/537.36 Edg/82.0.432.3"
<REDACTED> - - [04/Mar/2020:15:07:41 +0000] "GET /nextcloud/ocs/v2.php/cloud//groups HTTP/1.1" 200 825 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4056.0 Safari/537.36 Edg/82.0.432.3"
<REDACTED> - - [04/Mar/2020:15:07:41 +0000] "GET /nextcloud/cron.php HTTP/1.1" 200 905 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4056.0 Safari/537.36 Edg/82.0.432.3"
<REDACTED> - - [04/Mar/2020:15:07:41 +0000] "PROPFIND /.well-known/caldav HTTP/1.1" 405 584 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4056.0 Safari/537.36 Edg/82.0.432.3"
<REDACTED> - - [04/Mar/2020:15:07:41 +0000] "PROPFIND /.well-known/carddav HTTP/1.1" 405 584 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4056.0 Safari/537.36 Edg/82.0.432.3"
<REDACTED> - - [04/Mar/2020:15:07:41 +0000] "PROPFIND /nextcloud/remote.php/webdav HTTP/1.1" 207 2150 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4056.0 Safari/537.36 Edg/82.0.432.3"
<REDACTED> - - [04/Mar/2020:15:07:41 +0000] "GET /nextcloud/ocm-provider/ HTTP/1.1" 200 1116 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4056.0 Safari/537.36 Edg/82.0.432.3"
<REDACTED> - - [04/Mar/2020:15:07:41 +0000] "GET /nextcloud/ocs-provider/ HTTP/1.1" 200 1710 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4056.0 Safari/537.36 Edg/82.0.432.3"
<REDACTED> - - [04/Mar/2020:15:07:41 +0000] "GET /nextcloud/index.php/heartbeat HTTP/1.1" 200 877 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4056.0 Safari/537.36 Edg/82.0.432.3"
<REDACTED> - - [04/Mar/2020:15:07:41 +0000] "GET /nextcloud/data/.ocdata?t=1583334461699 HTTP/1.1" 302 968 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4056.0 Safari/537.36 Edg/82.0.432.3"
<REDACTED> - - [04/Mar/2020:15:07:41 +0000] "GET /nextcloud/index.php/apps/files/ HTTP/1.1" 200 6594 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4056.0 Safari/537.36 Edg/82.0.432.3"
<REDACTED> - - [04/Mar/2020:15:07:41 +0000] "GET /nextcloud/index.php/settings/ajax/checksetup HTTP/1.1" 200 2463 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4056.0 Safari/537.36 Edg/82.0.432.3"

Does .htaccess work?

I don’t understand the question. I’ve added .htaccess to the root of the webserver per the documentation but the server is still reporting that the discovery URLs aren’t working.

Is you webserver configured to allow .htaccess files?

Thank you for the clarification.

Just to be sure, I extended the Apache configuration file to include the appropriate configuration:

Alias /nextcloud "/var/www/nextcloud/"

<Directory /var/www/>
  Require all granted
  AllowOverride All
</Directory>

<Directory /var/www/nextcloud/>
  Require all granted
  AllowOverride All
  Options FollowSymLinks MultiViews

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

</Directory>

I’ve restarted Apache but to no avail.

The error log is only showing this when I ask NC to update the warnings page:

AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata

The “other_vhosts_access” log is showing that an error code is returned when the “well known” URLs are queried:

"PROPFIND /.well-known/caldav HTTP/1.1" 405
"PROPFIND /.well-known/carddav HTTP/1.1" 405

I ended up solving this by moving the NC installation to the root directory.