NextcloudPi and acme.sh problems

Nextcloud version: NextCloudPi v1.39.19
Operating system and version: Raspbian GNU/Linux 10 (buster)
Apache or nginx version: Apache/2.4.38
PHP version: PHP 7.3.29-1~deb10u1

The issue you are facing:
The other day I started getting sync errors with Enpass using Webdav. I thought it might have something to do with my certificates, so I tried to renew them. My isp (Cox Cable) block port 80, so I initially set up my certificates with this command:
sudo certbot -d subdomain.mydomain.tld --manual --preferred-challenges dns certonly
Later I set up automatic renewals with the Cloudflare API:

sudo certbot certonly --dns-cloudflare --cert-name subdomain.mydomain.tld --dns-cloudflare-credentials /etc/cloudflare/credential.ini -d subdomain.mydomain.tld --preferred-challenges dns-01

I forgot I’d done this, and in the course of renewing my certificates I exceeded letsencrypt’s limit. So then I switched over to using acme.sh. I messed it up somehow and now I can’t access my nextcloud dashboard.

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

Steps to replicate it:
Not sure.

sudo ncp-report:

NextCloudPi diagnostics

NextCloudPi version  v1.39.19
NextCloudPi image    NextCloudPi_07-21-19
distribution         Raspbian GNU/Linux 10 \n \l
automount            yes
USB devices          sda
datadir              /media/myCloudDrive/ncdata
data in SD           no
data filesystem      btrfs
data disk usage      533G/1.9T
rootfs usage         3.5G/30G
swapfile             /var/swap
dbdir                /var/lib/mysql
Nextcloud check      error
HTTPD service        up
PHP service          up
MariaDB service      up
Redis service        up
HPB service          down
Postfix service      up
internet check       ok
port check 80        closed
port check 443       open
IP                   ***REMOVED SENSITIVE VALUE***
gateway              ***REMOVED SENSITIVE VALUE***
interface            eth0
certificates         ***REMOVED SENSITIVE VALUE***
NAT loopback         no
uptime               36min

Nextcloud configuration

Could not open input file: /var/www/nextcloud/occ

HTTPd logs

[Fri Oct 01 17:27:22.444225 2021] [authz_host:error] [pid 7160:tid 2764047360] [client 192.168.131.33:56249] AH01753: access check of 'localhost' to /img/dashboard.svg failed, reason: unable to get the remote host name, referer: https://192.168.131.112:4443/css/ncp.css
[Fri Oct 01 17:27:22.444938 2021] [authz_host:error] [pid 7160:tid 2755646464] [client 192.168.131.33:56249] AH01753: access check of 'localhost' to /img/defaults-white.svg failed, reason: unable to get the remote host name, referer: https://192.168.131.112:4443/css/ncp.css
[Fri Oct 01 17:27:22.445117 2021] [authz_host:error] [pid 7160:tid 2772448256] [client 192.168.131.33:56249] AH01753: access check of 'localhost' to /img/wizard.svg failed, reason: unable to get the remote host name, referer: https://192.168.131.112:4443/css/ncp.css
[Fri Oct 01 17:27:22.445122 2021] [authz_host:error] [pid 7160:tid 2789250048] [client 192.168.131.33:56249] AH01753: access check of 'localhost' to /img/info-white.svg failed, reason: unable to get the remote host name, referer: https://192.168.131.112:4443/css/ncp.css
[Fri Oct 01 17:27:22.445334 2021] [authz_host:error] [pid 7160:tid 2764047360] [client 192.168.131.33:56249] AH01753: access check of 'localhost' to /img/settings-white.svg failed, reason: unable to get the remote host name, referer: https://192.168.131.112:4443/css/ncp.css
[Fri Oct 01 17:27:22.445641 2021] [authz_host:error] [pid 7160:tid 2789250048] [client 192.168.131.33:56249] AH01753: access check of 'localhost' to /img/files.svg failed, reason: unable to get the remote host name, referer: https://192.168.131.112:4443/css/ncp.css
[Fri Oct 01 17:27:22.512984 2021] [authz_host:error] [pid 7160:tid 2755646464] [client 192.168.131.33:56249] AH01753: access check of 'localhost' to /ncp-output.php failed, reason: unable to get the remote host name
[Fri Oct 01 17:27:22.513170 2021] [authz_host:error] [pid 7160:tid 2764047360] [client 192.168.131.33:56249] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Fri Oct 01 17:27:22.768444 2021] [authz_host:error] [pid 7160:tid 2789250048] [client 192.168.131.33:56249] AH01753: access check of 'localhost' to /img/favicon.png failed, reason: unable to get the remote host name
[Fri Oct 01 17:27:28.293597 2021] [authz_host:error] [pid 7160:tid 2764047360] [client 192.168.131.33:56249] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Fri Oct 01 17:27:28.299049 2021] [proxy_fcgi:error] [pid 7160:tid 2764047360] [client 192.168.131.33:56249] AH01071: Got error 'PHP message: PHP Warning:  include(/var/www/nextcloud/config/config.php): failed to open stream: Permission denied in /var/www/ncp-web/backups.php on line 133PHP message: PHP Warning:  include(): Failed opening '/var/www/nextcloud/config/config.php' for inclusion (include_path='.:/usr/share/php') in /var/www/ncp-web/backups.php on line 133PHP message: PHP Notice:  Undefined variable: CONFIG in /var/www/ncp-web/backups.php on line 135'
[Fri Oct 01 17:27:28.318918 2021] [authz_host:error] [pid 7160:tid 2764047360] [client 192.168.131.33:56249] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Fri Oct 01 17:42:46.165130 2021] [mpm_event:notice] [pid 7159:tid 3069948480] AH00493: SIGUSR1 received.  Doing graceful restart
[Fri Oct 01 17:42:46.191236 2021] [ssl:warn] [pid 7159:tid 3069948480] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Fri Oct 01 17:42:46.193033 2021] [mpm_event:notice] [pid 7159:tid 3069948480] AH00489: Apache/2.4.38 (Raspbian) OpenSSL/1.1.1d configured -- resuming normal operations
[Fri Oct 01 17:42:46.193074 2021] [core:notice] [pid 7159:tid 3069948480] AH00094: Command line: '/usr/sbin/apache2'
[Fri Oct 01 17:42:46.345726 2021] [mpm_event:notice] [pid 7159:tid 3069948480] AH00493: SIGUSR1 received.  Doing graceful restart
[Fri Oct 01 17:42:46.372930 2021] [ssl:warn] [pid 7159:tid 3069948480] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Fri Oct 01 17:42:46.374663 2021] [mpm_event:notice] [pid 7159:tid 3069948480] AH00489: Apache/2.4.38 (Raspbian) OpenSSL/1.1.1d configured -- resuming normal operations
[Fri Oct 01 17:42:46.374699 2021] [core:notice] [pid 7159:tid 3069948480] AH00094: Command line: '/usr/sbin/apache2'

Database logs

2021-10-01 17:21:00 0 [Note] InnoDB: Uses event mutexes
2021-10-01 17:21:00 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-10-01 17:21:00 0 [Note] InnoDB: Number of pools: 1
2021-10-01 17:21:00 0 [Note] InnoDB: Using generic crc32 instructions
2021-10-01 17:21:00 0 [Note] InnoDB: Initializing buffer pool, total size = 1G, instances = 1, chunk size = 128M
2021-10-01 17:21:00 0 [Note] InnoDB: Completed initialization of buffer pool
2021-10-01 17:21:00 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-10-01 17:21:01 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2021-10-01 17:21:01 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-10-01 17:21:01 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-10-01 17:21:01 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-10-01 17:21:01 0 [Note] InnoDB: 10.3.29 started; log sequence number 40751542163; transaction id 58176127
2021-10-01 17:21:01 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2021-10-01 17:21:01 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-10-01 17:21:01 0 [Note] Server socket created on IP: '127.0.0.1'.
2021-10-01 17:21:01 0 [Note] Reading of all Master_info entries succeeded
2021-10-01 17:21:01 0 [Note] Added new Master_info '' to hash table
2021-10-01 17:21:01 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.3.29-MariaDB-0+deb10u1'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Raspbian 10
2021-10-01 17:21:11 0 [Note] InnoDB: Buffer pool(s) load completed at 211001 17:21:11

Nextcloud logs

{"reqId":"YVdKzqfDIBe7P4-ie5mpSQAAAJc","level":0,"time":"2021-10-01T17:52:14+00:00","remoteAddr":"192.168.131.1","user":"--","app":"drawio","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdKzqfDIBe7P4-ie5mpSQAAAJc","level":0,"time":"2021-10-01T17:52:14+00:00","remoteAddr":"192.168.131.1","user":"--","app":"files_sharing","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdKzqfDIBe7P4-ie5mpSQAAAJc","level":0,"time":"2021-10-01T17:52:14+00:00","remoteAddr":"192.168.131.1","user":"--","app":"files_mindmap","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdKzqfDIBe7P4-ie5mpSQAAAJc","level":0,"time":"2021-10-01T17:52:14+00:00","remoteAddr":"192.168.131.1","user":"--","app":"socialsharing_email","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdKzqfDIBe7P4-ie5mpSQAAAJc","level":0,"time":"2021-10-01T17:52:14+00:00","remoteAddr":"192.168.131.1","user":"--","app":"socialsharing_facebook","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdK7KfDIBe7P4-ie5mpSgAAAJM","level":0,"time":"2021-10-01T17:52:44+00:00","remoteAddr":"192.168.131.1","user":"--","app":"drawio","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdK7KfDIBe7P4-ie5mpSgAAAJM","level":0,"time":"2021-10-01T17:52:44+00:00","remoteAddr":"192.168.131.1","user":"--","app":"files_sharing","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdK7KfDIBe7P4-ie5mpSgAAAJM","level":0,"time":"2021-10-01T17:52:44+00:00","remoteAddr":"192.168.131.1","user":"--","app":"files_mindmap","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdK7KfDIBe7P4-ie5mpSgAAAJM","level":0,"time":"2021-10-01T17:52:44+00:00","remoteAddr":"192.168.131.1","user":"--","app":"socialsharing_email","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdK7KfDIBe7P4-ie5mpSgAAAJM","level":0,"time":"2021-10-01T17:52:44+00:00","remoteAddr":"192.168.131.1","user":"--","app":"socialsharing_facebook","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdLCqfDIBe7P4-ie5mpSwAAAJE","level":0,"time":"2021-10-01T17:53:15+00:00","remoteAddr":"192.168.131.1","user":"--","app":"drawio","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdLCqfDIBe7P4-ie5mpSwAAAJE","level":0,"time":"2021-10-01T17:53:15+00:00","remoteAddr":"192.168.131.1","user":"--","app":"files_sharing","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdLCqfDIBe7P4-ie5mpSwAAAJE","level":0,"time":"2021-10-01T17:53:15+00:00","remoteAddr":"192.168.131.1","user":"--","app":"files_mindmap","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdLCqfDIBe7P4-ie5mpSwAAAJE","level":0,"time":"2021-10-01T17:53:15+00:00","remoteAddr":"192.168.131.1","user":"--","app":"socialsharing_email","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdLCqfDIBe7P4-ie5mpSwAAAJE","level":0,"time":"2021-10-01T17:53:15+00:00","remoteAddr":"192.168.131.1","user":"--","app":"socialsharing_facebook","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdLKKfDIBe7P4-ie5mpTAAAAI4","level":0,"time":"2021-10-01T17:53:45+00:00","remoteAddr":"192.168.131.1","user":"--","app":"drawio","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdLKKfDIBe7P4-ie5mpTAAAAI4","level":0,"time":"2021-10-01T17:53:45+00:00","remoteAddr":"192.168.131.1","user":"--","app":"files_sharing","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdLKKfDIBe7P4-ie5mpTAAAAI4","level":0,"time":"2021-10-01T17:53:45+00:00","remoteAddr":"192.168.131.1","user":"--","app":"files_mindmap","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdLKKfDIBe7P4-ie5mpTAAAAI4","level":0,"time":"2021-10-01T17:53:45+00:00","remoteAddr":"192.168.131.1","user":"--","app":"socialsharing_email","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}
{"reqId":"YVdLKKfDIBe7P4-ie5mpTAAAAI4","level":0,"time":"2021-10-01T17:53:45+00:00","remoteAddr":"192.168.131.1","user":"--","app":"socialsharing_facebook","method":"POST","url":"/index.php/login/v2/poll","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows) mirall/3.3.4stable-Win64 (build 20210920) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.4.1"}

/var/www/nextcloud/config/config.php:

<?php
$CONFIG = array (
  'passwordsalt' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXX',
  'secret' => 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY/ZZZZZZZZZZZZZ',
  'trusted_domains' =>
  array (
    0 => 'subdomain.mydomain.tld',
    5 => 'nextcloudpi.local',
    7 => 'nextcloudpi',
    8 => 'nextcloudpi.lan',
    11 => 'my-external-ip',
    1 => '192.168.131.112',
    20 => 'subdomain.mydomain.tld',
    12 => 'subdomain.mydomain.tld',
    2 => '192.168.131.112',
    3 => 'subdomain.mydomain.tld',
    22 => 'subdomain.mydomain.tld',
  ),
  'datadirectory' => '/media/myCloudDrive/ncdata',
  'dbtype' => 'mysql',
  'version' => '21.0.4.1',
  'overwrite.cli.url' => 'https://subdomain.mydomain.tld/',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'ncadmin',
  'dbpassword' => 'WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW',
  'installed' => true,
  'instanceid' => 'oclaqn5ofjmm',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
    'password' => 'NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN',
  ),
  'tempdirectory' => '/media/myCloudDrive/ncdata/tmp',
  'mail_smtpmode' => 'sendmail',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'admin',
  'mail_domain' => 'ownyourbits.com',
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '60',
  'overwriteprotocol' => 'https',
  'maintenance' => false,
  'logfile' => '/media/myCloudDrive/ncdata/nextcloud.log',
  'loglevel' => 0,
  'log_type' => 'file',
  'has_rebuilt_cache' => true,
  'theme' => '',
  'trusted_proxies' =>
  array (
    11 => '127.0.0.1',
    12 => '::1',
    13 => 'subdomain.mydomain.tld',
    14 => 'my-external-ip',
  ),
);

/var/log/apache2/error.log:

[Fri Oct 01 17:19:50.831849 2021] [mpm_event:notice] [pid 1200:tid 3069989440] AH00493: SIGUSR1 received.  Doing graceful restart
[Fri Oct 01 17:19:50.862192 2021] [ssl:warn] [pid 1200:tid 3069989440] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Fri Oct 01 17:19:50.863820 2021] [mpm_event:notice] [pid 1200:tid 3069989440] AH00489: Apache/2.4.38 (Raspbian) OpenSSL/1.1.1d configured -- resuming normal operations
[Fri Oct 01 17:19:50.863861 2021] [core:notice] [pid 1200:tid 3069989440] AH00094: Command line: '/usr/sbin/apache2'
[Fri Oct 01 17:20:01.394212 2021] [mpm_event:notice] [pid 1200:tid 3069989440] AH00491: caught SIGTERM, shutting down
[Fri Oct 01 17:20:26.094930 2021] [ssl:warn] [pid 1112:tid 3069133376] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Fri Oct 01 17:20:26.132555 2021] [ssl:warn] [pid 1212:tid 3069133376] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Fri Oct 01 17:20:26.138670 2021] [mpm_event:notice] [pid 1212:tid 3069133376] AH00489: Apache/2.4.38 (Raspbian) OpenSSL/1.1.1d configured -- resuming normal operations
[Fri Oct 01 17:20:26.138787 2021] [core:notice] [pid 1212:tid 3069133376] AH00094: Command line: '/usr/sbin/apache2'
[Fri Oct 01 17:23:13.800691 2021] [authz_host:error] [pid 1213:tid 2754831360] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to / failed, reason: unable to get the remote host name
[Fri Oct 01 17:23:13.912897 2021] [authz_host:error] [pid 1213:tid 2754831360] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to / failed, reason: unable to get the remote host name
[Fri Oct 01 17:23:13.914096 2021] [authz_host:error] [pid 1213:tid 2754831360] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to /index.php failed, reason: unable to get the remote host name
[Fri Oct 01 17:23:13.993465 2021] [authz_host:error] [pid 1213:tid 2754831360] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to /index.php failed, reason: unable to get the remote host name
[Fri Oct 01 17:23:15.023474 2021] [proxy_fcgi:error] [pid 1213:tid 2754831360] [client 192.168.131.33:56144] AH01071: Got error 'PHP message: PHP Warning:  include(/var/www/nextcloud/config/config.php): failed to open stream: Permission denied in /var/www/ncp-web/index.php on line 249PHP message: PHP Warning:  include(): Failed opening '/var/www/nextcloud/config/config.php' for inclusion (include_path='.:/usr/share/php') in /var/www/ncp-web/index.php on line 249PHP message: PHP Notice:  Undefined variable: CONFIG in /var/www/ncp-web/index.php on line 252PHP message: PHP Warning:  Invalid argument supplied for foreach() in /var/www/ncp-web/index.php on line 252'
[Fri Oct 01 17:23:15.033640 2021] [authz_host:error] [pid 1213:tid 2754831360] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to /js/minified.js failed, reason: unable to get the remote host name
[Fri Oct 01 17:23:15.033748 2021] [authz_host:error] [pid 1213:tid 2763232256] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to /js/ncp.js failed, reason: unable to get the remote host name
[Fri Oct 01 17:23:15.033852 2021] [authz_host:error] [pid 1213:tid 2796835840] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to /css/ncp.css failed, reason: unable to get the remote host name
[Fri Oct 01 17:23:15.034629 2021] [authz_host:error] [pid 1213:tid 2771633152] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to /img/ncp-logo.svg failed, reason: unable to get the remote host name
[Fri Oct 01 17:23:15.034938 2021] [authz_host:error] [pid 1213:tid 2813637632] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to /img/loading-small.gif failed, reason: unable to get the remote host name
[Fri Oct 01 17:23:15.457616 2021] [authz_host:error] [pid 1213:tid 2796835840] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to /img/toggle.svg failed, reason: unable to get the remote host name
[Fri Oct 01 17:23:15.457896 2021] [authz_host:error] [pid 1213:tid 2796835840] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to /img/defaults.svg failed, reason: unable to get the remote host name
[Fri Oct 01 17:23:15.458118 2021] [authz_host:error] [pid 1213:tid 2796835840] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to /img/poweroff.svg failed, reason: unable to get the remote host name
[Fri Oct 01 17:23:21.227429 2021] [proxy_fcgi:error] [pid 1213:tid 2813637632] [client 192.168.131.33:56144] AH01071: Got error 'PHP message: PHP Warning:  include(/var/www/nextcloud/config/config.php): failed to open stream: Permission denied in /var/www/ncp-web/backups.php on line 133PHP message: PHP Warning:  include(): Failed opening '/var/www/nextcloud/config/config.php' for inclusion (include_path='.:/usr/share/php') in /var/www/ncp-web/backups.php on line 133PHP message: PHP Notice:  Undefined variable: CONFIG in /var/www/ncp-web/backups.php on line 135'
[Fri Oct 01 17:23:21.238722 2021] [authz_host:error] [pid 1213:tid 2813637632] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Fri Oct 01 17:24:34.947322 2021] [authz_host:error] [pid 1213:tid 2813637632] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to /img/info.svg failed, reason: unable to get the remote host name, referer: https://192.168.131.112:4443/css/ncp.css
[Fri Oct 01 17:25:12.103641 2021] [authz_host:error] [pid 1213:tid 2813637632] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Fri Oct 01 17:25:12.782372 2021] [authz_host:error] [pid 1213:tid 2813637632] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to /img/red-circle.svg failed, reason: unable to get the remote host name, referer: https://192.168.131.112:4443/css/ncp.css
[Fri Oct 01 17:25:18.710054 2021] [authz_host:error] [pid 1213:tid 2813637632] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Fri Oct 01 17:25:21.190727 2021] [authz_host:error] [pid 1213:tid 2813637632] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name
[Fri Oct 01 17:25:39.935860 2021] [authz_host:error] [pid 1213:tid 2813637632] [client 192.168.131.33:56144] AH01753: access check of 'localhost' to /img/green-circle.svg failed, reason: unable to get the remote host name, referer: https://192.168.131.112:4443/css/ncp.css
[Fri Oct 01 17:26:27.203746 2021] [proxy_fcgi:error] [pid 1213:tid 2754831360] [client 192.168.131.33:56144] AH01067: Failed to read FastCGI header
[Fri Oct 01 17:26:27.203859 2021] [proxy_fcgi:error] [pid 1213:tid 2754831360] (104)Connection reset by peer: [client 192.168.131.33:56144] AH01075: Error dispatching request to :4443:
[Fri Oct 01 17:26:32.233379 2021] [authz_host:error] [pid 1214:tid 2754831360] [client 192.168.131.33:56232] AH01753: access check of 'localhost' to /ncp-output.php failed, reason: unable to get the remote host name
[Fri Oct 01 17:26:49.185230 2021] [mpm_event:notice] [pid 1212:tid 3069133376] AH00491: caught SIGTERM, shutting down
[Fri Oct 01 17:26:49.311610 2021] [ssl:warn] [pid 7158:tid 3069948480] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Fri Oct 01 17:26:49.337953 2021] [ssl:warn] [pid 7159:tid 3069948480] AH01909: localhost:4443:0 server certificate does NOT include an ID which matches the server name
[Fri Oct 01 17:26:49.344336 2021] [mpm_event:notice] [pid 7159:tid 3069948480] AH00489: Apache/2.4.38 (Raspbian) OpenSSL/1.1.1d configured -- resuming normal operations
[Fri Oct 01 17:26:49.344445 2021] [core:notice] [pid 7159:tid 3069948480] AH00094: Command line: '/usr/sbin/apache2'
[Fri Oct 01 17:27:21.765499 2021] [authz_host:error] [pid 7160:tid 2755646464] [client 192.168.131.33:56249] AH01753: access check of 'localhost' to / failed, reason: unable to get the remote host name
[Fri Oct 01 17:27:21.883850 2021] [authz_host:error] [pid 7160:tid 2755646464] [client 192.168.131.33:56249] AH01753: access check of 'localhost' to / failed, reason: unable to get the remote host name
[Fri Oct 01 17:27:21.884214 2021] [authz_host:error] [pid 7160:tid 2755646464] [client 192.168.131.33:56249] AH01753: access check of 'localhost' to /index.php failed, reason: unable to get the remote host name
[Fri Oct 01 17:27:21.963213 2021] [authz_host:error] [pid 7160:tid 2755646464] [client 192.168.131.33:56249] AH01753: access check of 'localhost' to /index.php failed, reason: unable to get the remote host name
[Fri Oct 01 17:27:22.175233 2021] [proxy_fcgi:error] [pid 7160:tid 2755646464] [client 192.168.131.33:56249] AH01071: Got error 'PHP message: PHP Warning:  include(/var/www/nextcloud/config/config.php): failed to open stream: Permission denied in /var/www/ncp-web/index.php on line 249PHP message: PHP Warning:  include(): Failed opening '/var/www/nextcloud/config/config.php' for inclusion (include_path='.:/usr/share/php') in /var/www/ncp-web/index.php on line 249PHP message: PHP Notice:  Undefined variable: CONFIG in /var/www/ncp-web/index.php on line 252PHP message: PHP Warning:  Invalid argument supplied for foreach() in /var/www/ncp-web/index.php on line 252'
[Fri Oct 01 17:27:28.299049 2021] [proxy_fcgi:error] [pid 7160:tid 2764047360] [client 192.168.131.33:56249] AH01071: Got error 'PHP message: PHP Warning:  include(/var/www/nextcloud/config/config.php): failed to open stream: Permission denied in /var/www/ncp-web/backups.php on line 133PHP message: PHP Warning:  include(): Failed opening '/var/www/nextcloud/config/config.php' for inclusion (include_path='.:/usr/share/php') in /var/www/ncp-web/backups.php on line 133PHP message: PHP Notice:  Undefined variable: CONFIG in /var/www/ncp-web/backups.php on line 135'
[Fri Oct 01 17:27:28.318918 2021] [authz_host:error] [pid 7160:tid 2764047360] [client 192.168.131.33:56249] AH01753: access check of 'localhost' to /ncp-launcher.php failed, reason: unable to get the remote host name

I can now access the Nextcloud dashboard after ownership of the /var/www folder:
sudo chown www-data:www-data -R /var/www

I still get the following error in Joplin when trying to sync over Webdav:

Completed: 10/02/2021 09:16 (22s)
Last error: Error: GET info.json: No public access to this resource., No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured (Exception Sabre\DAV\Exception\NotAuthenticated) (401): <?xml version="1.0" encoding="utf-8"?> <d:error xmlns:d="DAV:" x

My sync folder:
https://subdomain.mydomain.tld/remote.php/dav/files/ncp/Cloud-Data/Joplin

It’s fixed. I removed the sync connection from Enpass and readded it. Joplin is working now too.