Your data directory and files are probably accessible from the internet. The .htaccess file is not working. It is strongly recommended that you configure your web server so that the data directory is no longer accessible, or move the data directory outsid

Hello, getting the error:

Your data directory and files are probably accessible from the internet. The .htaccess file is not working. It is strongly recommended that you configure your web server so that the data directory is no longer accessible, or move the data directory outside the web server document root.

And also this error:

Your web server is not properly set up to resolve `.well-known` URLs, failed on: `/.well-known/caldav` For more details see the documentation ↗.

Version (Docker): nextcloud:29.0.12

Volume Mounts:


        - mountPath: /var/www/html
          name: nextcloud-data
        - mountPath: /data-dir
          name: nextcloud-datadir

Troubleshooting:

root@nextcloud-588b687477-mx6m8:/var/www/html# ls -ahl
total 1.3M
drwxr-xr-x 1 www-data www-data  546 Mar 12 12:06 .
drwxrwxr-x 1 www-data root     4.0K Feb 26 01:29 ..
-rwxr-xr-x 1 www-data www-data 5.4K Mar 11 08:36 .htaccess
-rwxr-xr-x 1 www-data www-data  101 Mar  9 10:42 .user.ini
drwxr-xr-x 1 www-data www-data  802 Mar  9 10:43 3rdparty
-rwxr-xr-x 1 www-data www-data  24K Mar  9 10:42 AUTHORS
-rwxr-xr-x 1 www-data www-data  34K Mar  9 10:42 COPYING
drwxr-xr-x 1 www-data www-data 1.2K Mar  9 10:44 apps
-rwxr-xr-x 1 www-data www-data 2.1K Mar  9 10:42 composer.json
-rwxr-xr-x 1 www-data www-data 3.1K Mar  9 10:42 composer.lock
drwxr-xr-x 1 www-data www-data  418 Mar 11 08:36 config
-rwxr-xr-x 1 www-data www-data 4.1K Mar  9 10:42 console.php
drwxr-xr-x 1 www-data www-data  526 Mar  9 10:44 core
-rwxr-xr-x 1 www-data www-data 8.3K Mar  9 10:42 cron.php
drwxr-xr-x 1 www-data www-data   36 Mar 12 08:47 custom_apps
drwxr-xr-x 1 www-data www-data  15K Mar  9 10:45 dist
-rwxr-xr-x 1 www-data www-data  156 Mar  9 10:42 index.html
-rwxr-xr-x 1 www-data www-data 4.5K Mar  9 10:42 index.php
drwxr-xr-x 1 www-data www-data  126 Mar  9 10:45 lib
-rwxr-xr-x 1 root     root        0 Mar 12 11:57 nextcloud-init-sync.lock
-rwxr-xr-x 1 www-data www-data  283 Mar  9 10:42 occ
drwxr-xr-x 1 www-data www-data   50 Mar  9 10:45 ocs
drwxr-xr-x 1 www-data www-data   18 Mar  9 10:45 ocs-provider
-rwxr-xr-x 1 www-data www-data 1.1M Mar  9 10:42 package-lock.json
-rwxr-xr-x 1 www-data www-data 7.0K Mar  9 10:42 package.json
-rwxr-xr-x 1 www-data www-data 3.9K Mar  9 10:42 public.php
-rwxr-xr-x 1 www-data www-data 5.5K Mar  9 10:42 remote.php
drwxr-xr-x 1 www-data www-data  158 Mar  9 10:45 resources
-rwxr-xr-x 1 www-data www-data   26 Mar  9 10:42 robots.txt
-rwxr-xr-x 1 www-data www-data 2.5K Mar  9 10:42 status.php
drwxr-xr-x 1 www-data www-data   26 Mar  9 10:45 themes
-rwxr-xr-x 1 www-data www-data  385 Mar  9 10:45 version.php
root@nextcloud-588b687477-mx6m8:/var/www/html# ls -ahl /data-dir/
total 28K
drwxrwx--- 1 www-data www-data  132 Mar 13 05:08 .
drwxr-xr-x 1 root     root     4.0K Mar 12 11:57 ..
-rwxrwx--- 1 www-data www-data  542 Mar 11 08:36 .htaccess
-rwxrwx--- 1 www-data www-data    0 Mar 11 08:36 .ocdata
drwxrwx--- 1 www-data www-data   60 Mar 12 11:55 appdata_oc6ksk9so9n0
-rwxrwx--- 1 www-data www-data    0 Mar 11 08:36 index.html
drwxrwx--- 1 www-data www-data   20 Mar 12 11:55 ncadmin
-rwxrwx--- 1 www-data www-data  18K Mar 12 08:42 nextcloud.log

Here’s my config.php:

<?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,
    ),
  ),
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'redis-nc.nc.svc.cluster.local.',
    'password' => '**SNIP**',
    'port' => 6379,
  ),
  'upgrade.disable-web' => true,
  'instanceid' => '**SNIP**',
  'passwordsalt' => '**SNIP**',
  'secret' => '**SNIP**',
  'trusted_domains' => 
  array (
    0 => 'my.public-fqdn.com',
    1 => 'nextcloud.nc.svc.cluster.local.',
  ),
  'datadirectory' => '/data-dir',
  'dbtype' => 'pgsql',
  'trusted_proxies'   => ['https-terminator-ip', 'rev-prox1-ip', 'rev-prox2-ip'],
  'version' => '29.0.12.2',
  'overwrite.cli.url' => 'http://nextcloud.nc.svc.cluster.local.',
  'overwriteprotocol' => 'https',
  'dbname' => 'nextcloud',
  'dbhost' => 'postgres-nc.nc.svc.cluster.local.',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_ncadmin',
  'dbpassword' => '**SNIP**',
  'installed' => true,
  'memories.db.triggers.fcu' => true,
  'memories.exiftool' => '/var/www/html/custom_apps/memories/bin-ext/exiftool-amd64-glibc',
  'memories.vod.path' => '/var/www/html/custom_apps/memories/bin-ext/go-vod-amd64',
);

rev-prox2 config:


map $http_upgrade $connection_upgrade {
  default upgrade;
  '' close;
}

server {
  listen 80;
  listen [::]:80;
  resolver 10.96.0.10 valid=10s;
  server_name my.public-fqdn.com;

  proxy_headers_hash_max_size 512;
  proxy_headers_hash_bucket_size 128;

  location / {
    add_header RP2 true always;
    proxy_pass http://nextcloud.nc.svc.cluster.local.:80;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    include conf.d/proxy.config;
    include conf.d/auth.config;
  }

  location /.well-known/carddav/ { # I also tried these without the trailing /.
      return 301 $scheme://$host/remote.php/dav;
  }

  location /.well-known/caldav/ {
      return 301 $scheme://$host/remote.php/dav;
  }

  location ~/check-rp2$ {
    add_header Content-Type text/plain;
    add_header RP2 true always;
    return 200 "check-rp2\n";
  }
  
  include conf.d/authelia.config;
}

I’ve tried to access my data files from a bastion within my Kubernetes network, and from my FQDN, but was not able. When navigating to the carddav directories from my FQDN, it’s returning a 301 to /remote.php/dav

This topic was automatically closed after 90 days. New replies are no longer allowed.