Nextcloud with nginx reverse-proxy not loading data directory when new URL path used

Issue summary: Changing the nextcloud access URL from to makes uploaded data inaccessible.

Docker Nextcloud tag: nextcloud:16.0.11-apache
Docker Nginx tag: nginx:1.19.0
Host Operating system and version: Ubuntu 20.04
Host Access URL:

When using nginx as a reverse proxy, and nextcloud with / as the URL path (i.e. overwritewebroot' => '/'), I can see all my data files that I’ve uploaded after I log in.

However, when I make modifications to the nginx.conf file and the nextcloud/config/config.php file to change the cloud’s URL path to /cloud, I don’t see the data files I uploaded when I log in, and instead see the following error:

This directory is unavailable, please check the logs or contact the administrator

Here are my configuration files (I’ve added in comments what I’ve changed between the broken/working case).


$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => '',
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'pgsql',
  'version' => '',
  'overwrite.cli.url' => '',
  'overwritewebroot' => '/cloud', # CHANGED FROM '/'
  'trusted_proxies' => 
  array (
    0 => '',
  'forwarded_for_headers' => 
  array (


http {
    include mime.types;
    default_type application/octet-stream;
    access_log /var/log/nginx/access.log combined;
    sendfile on;

    upstream cloud_server {
        server cloud_app:80 fail_timeout=0;

    server {
        listen *:80;
        client_max_body_size 10G;
        server_name_in_redirect off;
        keepalive_timeout 5;

        location = /.well-known/carddav {
                return 301 $scheme://$host:$server_port/cloud/remote.php/dav;
        location = /.well-known/caldav {
                return 301 $scheme://$host:$server_port/cloud/remote.php/dav;

        location /cloud { # CHANGED FROM 'location /'
            proxy_request_buffering off;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_redirect off;
            proxy_pass http://cloud_server/;

Why do you change the path from / to /cloud? If you use virtual named domains you can use the same ip address for multiple servers.

I only have one public IP (and technically a dynamic DNS domain). No sub-domain options.

Beside the point, I would still like to have all of my services delimited by the URL path: /, /cloud, /app2, /app3.

I think you can match CNAME(s) to your dyndns-name. Works for me fine.

Facing the same issue right now!
I’ve installed nextcloud and point to it via nginx proxy. So far so good but I changed the location to /location and suddenly, the message

This directory is unavailable, please check the logs or contact the administrator

Pops up…anyone got an idea what this could be? If I change it back to the root location / everything works perfectly fine and gets displayed without any issues!
Would appreciate any help.