Nextcloud behind Apache reverse proxy, remote.php becomes remote.phpp

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version: 15.0.7 (snap)
Operating system and version: Raspbian 9
Apache or nginx version: Apache 2.4.25 (reverse proxy)
PHP version: 7.2 (snap)

The issue you are facing:

Nextcloud behind reverse proxy just shows the spinner forever when trying to list files. Other views (admin, recent) seem to work, but I can’t download files. According to the Nextcloud logs something is wrong with webdav urls, “remote.php” becomes “remote.phpp”.

I installed the Nextcloud Snap on port 8000 (HTTP) and configured an Apache reverse proxy to rewrite the webroot.

I also reverse proxyed an existing (and working) Nextcloud instance, it shows the same behavior when proxied.

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

Steps to replicate it:

  1. Install nextcloud snap on port 8000, HTTP only.
  2. Configure Apache reverse proxy to rewrite webroot.
  3. Configure Nextcloud for reverse proxying.

The output of your Nextcloud log in Admin > Logging:

	{"reqId":"lmm4xf8GCtcoDlGrRWly","level":2,"time":"2019-04-21T20:58:40+00:00","remoteAddr":"127.0.0.1","user":"--","app":"core","method":"POST","url":"\/nextcloud\/index.phpp\/login","message":"Login failed: 'ncuser' (Remote IP: '127.0.0.1')","userAgent":"Mozilla\/5.0 (Windows NT 6.1; rv:60.0) Gecko\/20100101 Firefox\/60.0","version":"15.0.7.0"}
	{"reqId":"zjxDk5NtKMmCUrkivmRA","level":3,"time":"2019-04-21T21:05:56+00:00","remoteAddr":"127.0.0.1","user":"ncuser","app":"remote","method":"PROPFIND","url":"\/nextcloud\/remote.phpp\/dav\/files\/ncuser\/","message":{"Exception":"Sabre\\DAV\\Exception\\Forbidden","Message":"Requested uri (\/nextcloud\/remote.phpp\/dav\/files\/ncuser\/) is out of base uri (\/nextcloud\/remote.php\/dav\/)","Code":0,"Trace":[{"file":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":549,"function":"calculateUri","class":"Sabre\\DAV\\Server","type":"->","args":["\/nextcloud\/remote.phpp\/dav\/files\/ncuser\/"]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/apps\/dav\/lib\/Server.php","line":307,"function":"getRequestUri","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/apps\/dav\/lib\/Server.php","line":145,"function":"requestIsForSubtree","class":"OCA\\DAV\\Server","type":"->","args":[["calendars","public-calendars","system-calendars","principals"]]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/apps\/dav\/appinfo\/v2\/remote.php","line":34,"function":"__construct","class":"OCA\\DAV\\Server","type":"->","args":[{"__class__":"OC\\AppFramework\\Http\\Request"},"\/nextcloud\/remote.php\/dav\/"]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/remote.php","line":163,"args":["\/snap\/nextcloud\/12760\/htdocs\/apps\/dav\/appinfo\/v2\/remote.php"],"function":"require_once"}],"File":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","Line":588,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (Windows NT 6.1; rv:60.0) Gecko\/20100101 Firefox\/60.0","version":"15.0.7.0"}
	{"reqId":"Sid6dwr52oKs2uoYK5cK","level":3,"time":"2019-04-21T21:08:07+00:00","remoteAddr":"127.0.0.1","user":"ncuser","app":"remote","method":"PROPFIND","url":"\/nextcloud\/remote.phpp\/dav\/files\/ncuser\/","message":{"Exception":"Sabre\\DAV\\Exception\\Forbidden","Message":"Requested uri (\/nextcloud\/remote.phpp\/dav\/files\/ncuser\/) is out of base uri (\/nextcloud\/remote.php\/dav\/)","Code":0,"Trace":[{"file":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":549,"function":"calculateUri","class":"Sabre\\DAV\\Server","type":"->","args":["\/nextcloud\/remote.phpp\/dav\/files\/ncuser\/"]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/apps\/dav\/lib\/Server.php","line":307,"function":"getRequestUri","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/apps\/dav\/lib\/Server.php","line":145,"function":"requestIsForSubtree","class":"OCA\\DAV\\Server","type":"->","args":[["calendars","public-calendars","system-calendars","principals"]]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/apps\/dav\/appinfo\/v2\/remote.php","line":34,"function":"__construct","class":"OCA\\DAV\\Server","type":"->","args":[{"__class__":"OC\\AppFramework\\Http\\Request"},"\/nextcloud\/remote.php\/dav\/"]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/remote.php","line":163,"args":["\/snap\/nextcloud\/12760\/htdocs\/apps\/dav\/appinfo\/v2\/remote.php"],"function":"require_once"}],"File":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","Line":588,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (Windows NT 6.1; rv:60.0) Gecko\/20100101 Firefox\/60.0","version":"15.0.7.0"}
	{"reqId":"jX6KXtSfmol9XB8abqKg","level":4,"time":"2019-04-21T21:08:44+00:00","remoteAddr":"127.0.0.1","user":"ncuser","app":"webdav","method":"PROPFIND","url":"\/nextcloud\/remote.phpp\/webdav","message":{"Exception":"LogicException","Message":"Requested uri (\/nextcloud\/remote.phpp\/webdav) is out of base uri (\/nextcloud\/remote.php\/webdav\/)","Code":0,"Trace":[{"file":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":1296,"function":"getPath","class":"Sabre\\HTTP\\Request","type":"->","args":[]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":474,"function":"checkPreconditions","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"http:\/\/127.0.0.1:8000\/\/remote.php\/webdav","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"http:\/\/127.0.0.1:8000\/\/remote.php\/webdav","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/apps\/dav\/appinfo\/v1\/webdav.php","line":80,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/remote.php","line":163,"args":["\/snap\/nextcloud\/12760\/htdocs\/apps\/dav\/appinfo\/v1\/webdav.php"],"function":"require_once"}],"File":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/sabre\/http\/lib\/Request.php","Line":214,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (Windows NT 6.1; rv:60.0) Gecko\/20100101 Firefox\/60.0","version":"15.0.7.0"}
	{"reqId":"nRrgEbBdQ8XacMFCQcv7","level":3,"time":"2019-04-21T21:08:45+00:00","remoteAddr":"127.0.0.1","user":"ncuser","app":"internet_connection_check","method":"GET","url":"\/nextcloud\/index.phpp\/settings\/ajax\/checksetup","message":{"Exception":"GuzzleHttp\\Exception\\RequestException","Message":"cURL error 56: Recv failure: Connection reset by peer (see http:\/\/curl.haxx.se\/libcurl\/c\/libcurl-errors.html)","Code":0,"Trace":[{"file":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/guzzlehttp\/guzzle\/src\/Handler\/CurlFactory.php","line":149,"function":"createRejection","class":"GuzzleHttp\\Handler\\CurlFactory","type":"::","args":[{"sink":{"__class__":"GuzzleHttp\\Psr7\\Stream"},"headers":[],"response":null,"request":{"__class__":"GuzzleHttp\\Psr7\\Request"},"options":{"verify":"\/var\/snap\/nextcloud\/common\/nextcloud\/data\/files_external\/rootcerts.crt","synchronous":true,"handler":{"__class__":"GuzzleHttp\\HandlerStack"},"allow_redirects":{"max":5,"protocols":["http","https"],"strict":false,"referer":false,"track_redirects":false},"http_errors":true,"decode_content":true,"cookies":false},"errno":56,"onHeadersException":null,"__class__":"GuzzleHttp\\Handler\\EasyHandle"},{"errno":56,"error":"Recv failure: Connection reset by peer","url":"http:\/\/www.nextcloud.com\/","content_type":null,"http_code":0,"header_size":0,"request_size":96,"filetime":-1,"ssl_verify_result":0,"redirect_count":0,"total_time":0.083879000000000037,"namelookup_time":0.0045149999999999999,"connect_time":0.044143000000000002,"pretransfer_time":0.044261000000000002,"size_upload":0,"size_download":0,"speed_download":0,"speed_upload":0,"download_content_length":-1,"upload_content_length":-1,"starttransfer_time":0,"redirect_time":0,"redirect_url":"","primary_ip":"165.227.162.232","certinfo":[],"primary_port":80,"local_ip":"192.168.1.12","local_port":57084}]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/guzzlehttp\/guzzle\/src\/Handler\/CurlFactory.php","line":102,"function":"finishError","class":"GuzzleHttp\\Handler\\CurlFactory","type":"::","args":[{"__class__":"GuzzleHttp\\Handler\\CurlHandler"},{"sink":{"__class__":"GuzzleHttp\\Psr7\\Stream"},"headers":[],"response":null,"request":{"__class__":"GuzzleHttp\\Psr7\\Request"},"options":{"verify":"\/var\/snap\/nextcloud\/common\/nextcloud\/data\/files_external\/rootcerts.crt","synchronous":true,"handler":{"__class__":"GuzzleHttp\\HandlerStack"},"allow_redirects":{"max":5,"protocols":["http","https"],"strict":false,"referer":false,"track_redirects":false},"http_errors":true,"decode_content":true,"cookies":false},"errno":56,"onHeadersException":null,"__class__":"GuzzleHttp\\Handler\\EasyHandle"},{"__class__":"GuzzleHttp\\Handler\\CurlFactory"}]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/guzzlehttp\/guzzle\/src\/Handler\/CurlHandler.php","line":43,"function":"finish","class":"GuzzleHttp\\Handler\\CurlFactory","type":"::","args":[{"__class__":"GuzzleHttp\\Handler\\CurlHandler"},{"sink":{"__class__":"GuzzleHttp\\Psr7\\Stream"},"headers":[],"response":null,"request":{"__class__":"GuzzleHttp\\Psr7\\Request"},"options":{"verify":"\/var\/snap\/nextcloud\/common\/nextcloud\/data\/files_external\/rootcerts.crt","synchronous":true,"handler":{"__class__":"GuzzleHttp\\HandlerStack"},"allow_redirects":{"max":5,"protocols":["http","https"],"strict":false,"referer":false,"track_redirects":false},"http_errors":true,"decode_content":true,"cookies":false},"errno":56,"onHeadersException":null,"__class__":"GuzzleHttp\\Handler\\EasyHandle"},{"__class__":"GuzzleHttp\\Handler\\CurlFactory"}]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/guzzlehttp\/guzzle\/src\/Handler\/Proxy.php","line":28,"function":"__invoke","class":"GuzzleHttp\\Handler\\CurlHandler","type":"->","args":["*** sensitive parameter replaced ***","*** sensitive parameter replaced ***"]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/guzzlehttp\/guzzle\/src\/Handler\/Proxy.php","line":51,"function":"GuzzleHttp\\Handler\\{closure}","class":"GuzzleHttp\\Handler\\Proxy","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/guzzlehttp\/guzzle\/src\/PrepareBodyMiddleware.php","line":37,"function":"GuzzleHttp\\Handler\\{closure}","class":"GuzzleHttp\\Handler\\Proxy","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/guzzlehttp\/guzzle\/src\/Middleware.php","line":30,"function":"__invoke","class":"GuzzleHttp\\PrepareBodyMiddleware","type":"->","args":["*** sensitive parameter replaced ***","*** sensitive parameter replaced ***"]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/guzzlehttp\/guzzle\/src\/RedirectMiddleware.php","line":70,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/guzzlehttp\/guzzle\/src\/Middleware.php","line":60,"function":"__invoke","class":"GuzzleHttp\\RedirectMiddleware","type":"->","args":["*** sensitive parameter replaced ***","*** sensitive parameter replaced ***"]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/guzzlehttp\/guzzle\/src\/HandlerStack.php","line":67,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/guzzlehttp\/guzzle\/src\/Client.php","line":277,"function":"__invoke","class":"GuzzleHttp\\HandlerStack","type":"->","args":["*** sensitive parameter replaced ***","*** sensitive parameter replaced ***"]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/guzzlehttp\/guzzle\/src\/Client.php","line":125,"function":"transfer","class":"GuzzleHttp\\Client","type":"->","args":["*** sensitive parameter replaced ***","*** sensitive parameter replaced ***"]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/3rdparty\/guzzlehttp\/guzzle\/src\/Client.php","line":131,"function":"requestAsync","class":"GuzzleHttp\\Client","type":"->","args":["get",{"__class__":"GuzzleHttp\\Psr7\\Uri"},{"verify":"\/var\/snap\/nextcloud\/common\/nextcloud\/data\/files_external\/rootcerts.crt","synchronous":true,"handler":{"__class__":"GuzzleHttp\\HandlerStack"},"allow_redirects":{"max":5,"protocols":["http","https"],"strict":false,"referer":false,"track_redirects":false},"http_errors":true,"decode_content":true,"cookies":false,"_conditional":{"User-Agent":"GuzzleHttp\/6.3.3 curl\/7.47.0 PHP\/7.2.17"}}]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/lib\/private\/Http\/Client\/Client.php","line":161,"function":"request","class":"GuzzleHttp\\Client","type":"->","args":["get","http:\/\/www.nextcloud.com\/",{"verify":"\/var\/snap\/nextcloud\/common\/nextcloud\/data\/files_external\/rootcerts.crt","synchronous":true}]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/settings\/Controller\/CheckSetupController.php","line":157,"function":"get","class":"OC\\Http\\Client\\Client","type":"->","args":["http:\/\/www.nextcloud.com\/"]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/settings\/Controller\/CheckSetupController.php","line":140,"function":"isSiteReachable","class":"OC\\Settings\\Controller\\CheckSetupController","type":"->","args":["www.nextcloud.com"]},{"file":"\/snap\/nextcloud\/12760\/htdocs\/settings\/Controller\/CheckSetupController.php","line":696,"function":"isInternetConnectionWorking","class":"OC\\Settings\\Controller\\CheckSetupController","type":"->","args":[]},}


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

<?php
$CONFIG = array (
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/snap/nextcloud/current/htdocs/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/snap/nextcloud/current/nextcloud/extra-apps',
      'url' => '/extra-apps',
      'writable' => true,
    ),
  ),
  'supportedDatabases' =>
  array (
    0 => 'mysql',
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/tmp/sockets/redis.sock',
    'port' => 0,
  ),
  'instanceid' => 'redacted',
  'passwordsalt' => 'redacted',
  'secret' => 'redacted',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => 'mydyndns.asuscomm.com',
    2 => '192.168.1.12',
  ),
  'datadirectory' => '/media/nc-data',
  'dbtype' => 'mysql',
  'version' => '15.0.7.0',
  'overwrite.cli.url' => 'https://mydyndns.asuscomm.com/nextcloud',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'redacted',
  'overwritehost' => 'mydyndns.asuscomm.com',
  'overwriteprotocol' => 'https',
  'overwritewebroot' => '/nextcloud',
  'maintenance' => false,
  'auth.bruteforce.protection.enabled' => false,
  'trusted_proxies' =>
  array (
    0 => '192.168.1.12',
    1 => '127.0.0.1',
  ),
);

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

access log:

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Thu Apr 25 21:07:23.814827 2019] [mpm_event:notice] [pid 5762:tid 1995939840] AH00489: Apache/2.4.39 (Unix) configured -- resuming normal operations
[Thu Apr 25 21:07:23.815266 2019] [core:notice] [pid 5762:tid 1995939840] AH00094: Command line: 'httpd -d /snap/nextcloud/12760 -D FOREGROUND'
[Thu Apr 25 21:07:23.817491 2019] [unixd:alert] [pid 5763:tid 1995939840] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
[Thu Apr 25 21:07:23.817651 2019] [unixd:alert] [pid 5764:tid 1995939840] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
[Thu Apr 25 21:07:23.818098 2019] [unixd:alert] [pid 5765:tid 1995939840] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
[Thu Apr 25 21:07:24.820734 2019] [unixd:alert] [pid 5848:tid 1995939840] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
[Thu Apr 25 21:14:25.269724 2019] [mpm_event:notice] [pid 5762:tid 1995939840] AH00491: caught SIGTERM, shutting down
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Thu Apr 25 21:15:04.594880 2019] [mpm_event:notice] [pid 7600:tid 1995698176] AH00489: Apache/2.4.39 (Unix) configured -- resuming normal operations
[Thu Apr 25 21:15:04.595320 2019] [core:notice] [pid 7600:tid 1995698176] AH00094: Command line: 'httpd -d /snap/nextcloud/12760 -D FOREGROUND'
[Thu Apr 25 21:15:04.597689 2019] [unixd:alert] [pid 7601:tid 1995698176] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
[Thu Apr 25 21:15:04.597824 2019] [unixd:alert] [pid 7602:tid 1995698176] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
[Thu Apr 25 21:15:04.598187 2019] [unixd:alert] [pid 7603:tid 1995698176] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
[Thu Apr 25 21:23:00.119551 2019] [unixd:alert] [pid 8641:tid 1995698176] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive



error log:

[25-Apr-2019 19:06:56 UTC] PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory in /snap/nextcloud/12760/htdocs/lib/private/DB/Connection.php:64
Stack trace:
#0 /snap/nextcloud/12760/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /snap/nextcloud/12760/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /snap/nextcloud/12760/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /snap/nextcloud/12760/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /snap/nextcloud/12760/htdocs/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /snap/nextcloud/12760/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection in /snap/nextcloud/12760/htdocs/lib/private/DB/Connection.php on line 64
[25-Apr-2019 19:14:36 UTC] PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory in /snap/nextcloud/12760/htdocs/lib/private/DB/Connection.php:64
Stack trace:
#0 /snap/nextcloud/12760/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /snap/nextcloud/12760/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /snap/nextcloud/12760/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /snap/nextcloud/12760/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /snap/nextcloud/12760/htdocs/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /snap/nextcloud/12760/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection in /snap/nextcloud/12760/htdocs/lib/private/DB/Connection.php on line 64
[25-Apr-2019 19:14:36 UTC] PHP Fatal error:  Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory in /snap/nextcloud/12760/htdocs/lib/private/DB/Connection.php:64
Stack trace:
#0 /snap/nextcloud/12760/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /snap/nextcloud/12760/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /snap/nextcloud/12760/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /snap/nextcloud/12760/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /snap/nextcloud/12760/htdocs/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /snap/nextcloud/12760/htdocs/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection in /snap/nextcloud/12760/htdocs/lib/private/DB/Connection.php on line 64

Apache reverse proxy config:

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin webmaster@localhost

                DocumentRoot /var/www/reverse_proxy


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

                SSLEngine on

                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
:
                </Directory>
#</Location>

                ProxyPass       "/nextcloud" "http://127.0.0.1:8000/"  # Snap instance
                ProxyPassReverse "/nextcloud" "http://127.0.0.1:8000/"
                ProxyPass "/oldcloud" "http://192.168.1.11/oldcloud/" # Not snap
                ProxyPassReverse  "/oldcloud" "http://192.168.1.11/oldcloud/"
                ProxyPass "/" "http://127.0.0.1:8001/" # Static files
                ProxyPassReverse  "/" "http://127.0.0.1:8001/"

ServerName mydyndns.asuscomm.com
SSLCertificateFile /etc/letsencrypt/live/mydyndns.asuscomm.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mydyndns.asuscomm.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
        </VirtualHost>
</IfModule>

I solved it with the help of this post. I needed to remove the trailing slashes from the ProxyPass directives.

becomes

ProxyPass "/nextcloud" "http://127.0.0.1:8000" # Snap instance 
ProxyPassReverse "/nextcloud" "http://127.0.0.1:8000"
ProxyPass "/oldcloud" "http://192.168.1.11/oldcloud" # Not snap
ProxyPassReverse "/oldcloud" "http://192.168.1.11/oldcloud"
ProxyPass "/" "http://127.0.0.1:8001" # Static files
ProxyPassReverse "/" "http://127.0.0.1:8001"

For the others who are using docker, nginx reverse proxy to a nc container this helps !: Requested uri (/cloud/remote.phpp/dav/files/mburchard/) is out of base uri (/cloud/remote.php/dav/) · Issue #20707 · nextcloud/server · GitHub