Internal server error - AH01797, AH00529 ... and finally AH01071 - out of nowhere

Nextcloud version (eg, 20.0.5): 20.0.8.1
NextcloudPi version (eg, 20.0.5): 1.37.0
Operating system and version (eg, Ubuntu 20.04): Raspbian GNU/Linux 9
Apache or nginx version (eg, Apache 2.4.25): 2.4.25 (Raspbian)
PHP version (eg, 7.4): 7.2

The issue you are facing:

  • Trying to log into NextCloud from a client application fails
  • When opening the NextCloud site from a browser, I get the following message:
Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

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

YES, just today, some hours ago. Yesterday, NextCloud seemed to be working properly (synchronization, new files, …)

Steps to replicate it:

  1. enter the site url into the browser window

The output of your Nextcloud log in Admin > Logging:

[ not accessible ]

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

<?php
$CONFIG = array (
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    5 => 'nextcloudpi.local',
    7 => 'nextcloudpi',
    8 => 'nextcloudpi.lan',
    11 => 'xxx',
    1 => 'xxx',
    4 => 'xxx',
    12 => 'xxx',
  ),
  'datadirectory' => '/media/SSD_240GB/ncdata',
  'dbtype' => 'mysql',
  'version' => '20.0.8.1',
  'overwrite.cli.url' => 'https://xxx/',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'ncadmin',
  'dbpassword' => 'xxx',
  'installed' => true,
  'instanceid' => 'xxx',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
    'password' => 'xxx',
  ),
  'tempdirectory' => '/media/SSD_240GB/ncdata/tmp',
  'mail_smtpmode' => 'sendmail',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'admin',
  'mail_domain' => 'xxx',
  'overwriteprotocol' => 'https',
  'maintenance' => false,
  'logfile' => '/media/SSD_240GB/ncdata/nextcloud.log',
  'jpeg_quality' => '60',
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'data-fingerprint' => 'xxx',
  'loglevel' => 2,
  'theme' => '',
  'mail_sendmailmode' => 'smtp',
);

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

from more /var/log/apache2/nc-error.log.1

first, about hundreds of entries like these…

...

[Tue Jun 29 07:59:16.159126 2021] [access_compat:error] [pid 21630:tid 1690526768] [client 77.0.77.62:56946] AH01797: client denied by server configuration: /var/www/nextcloud/config
[Tue Jun 29 08:07:21.034287 2021] [access_compat:error] [pid 21630:tid 1698927664] [client 77.0.77.62:56986] AH01797: client denied by server configuration: /var/www/nextcloud/config
[Tue Jun 29 08:15:15.808146 2021] [access_compat:error] [pid 2196:tid 1698927664] [client 77.0.77.62:57026] AH01797: client denied by server configuration: /var/www/nextcloud/config
[Tue Jun 29 08:23:16.036049 2021] [access_compat:error] [pid 21630:tid 1698927664] [client 77.0.77.62:57066] AH01797: client denied by  server configuration: /var/www/nextcloud/config
[Tue Jun 29 08:39:15.969269 2021] [access_compat:error] [pid 21630:tid 1690526768] [client 77.0.77.62:57156] AH01797: client denied by server configuration: /var/www/nextcloud/config
[Tue Jun 29 08:55:15.936899 2021] [access_compat:error] [pid 21630:tid 1698927664] [client 77.0.77.62:57240] AH01797: client denied by server configuration: /var/www/nextcloud/config
[Wed Jun 30 02:27:35.900554 2021] [access_compat:error] [pid 24195:tid 1571767344] [client 77.1.143.128:57774] AH01797: client denied by server configuration: /var/www/nextcloud/config

...

then one like this…

[Wed Jun 30 23:24:12.727497 2021] [proxy_fcgi:error] [pid 21630:tid 1596945456] [client 18.237.226.165:58558] AH01071: Got error 'Primary script unknown\n', referer: http://77.1.143.128:80/wp-login.php

and one like this…

[Sun Jul 04 00:34:44.303141 2021] [ssl:error] [pid 24195:tid 1580160048] [client 77.6.13.205:55525] AH01980: bad response from OCSP server: 503 Service Unavailable

then the ones from today in the morning…

[Mon Jul 05 06:44:53.177815 2021] [core:crit] [pid 2196:tid 1630516272] (13)Permission denied: [client 192.168.1.168:48600] AH00529: /var/www/nextcloud/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/nextcloud/' is executable
[Mon Jul 05 06:45:21.297862 2021] [core:crit] [pid 2196:tid 1546589232] (13)Permission denied: [client 95.116.230.117:56847] AH00529: /var/www/nextcloud/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/nextcloud/' is executable
[Mon Jul 05 06:45:25.281197 2021] [core:crit] [pid 2196:tid 1647301680] (13)Permission denied: [client 192.168.1.168:48612] AH00529: /var/www/nextcloud/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/nextcloud/' is executable
[Mon Jul 05 06:45:57.514632 2021] [core:crit] [pid 2196:tid 1496233008] (13)Permission denied: [client 192.168.1.168:48614] AH00529: /var/www/nextcloud/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/nextcloud/' is executable
[Mon Jul 05 06:46:23.316615 2021] [core:crit] [pid 2196:tid 1487840304] (13)Permission denied: [client 95.116.230.117:56859] AH00529: /var/www/nextcloud/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/nextcloud/' is executable
[Mon Jul 05 06:46:29.147664 2021] [core:crit] [pid 24195:tid 1462637616] (13)Permission denied: [client 192.168.1.168:48626] AH00529: /var/www/nextcloud/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/nextcloud/' is executable
[Mon Jul 05 06:47:01.136826 2021] [core:crit] [pid 24195:tid 1571767344] (13)Permission denied: [client 192.168.1.168:48628] AH00529: /var/www/nextcloud/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/nextcloud/' is executable
[Mon Jul 05 06:47:27.424748 2021] [core:crit] [pid 24195:tid 1588552752] (13)Permission denied: [client 95.116.230.117:56868] AH00529: /var/www/nextcloud/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/nextcloud/' is executable
[Mon Jul 05 06:47:33.405325 2021] [core:crit] [pid 2196:tid 1571767344] (13)Permission denied: [client 192.168.1.168:48640] AH00529: /var/www/nextcloud/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/nextcloud/' is executable
[Mon Jul 05 06:47:39.979833 2021] [core:crit] [pid 24195:tid 1630516272] (13)Permission denied: [client 95.116.230.117:46941] AH00529: /var/www/nextcloud/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/nextcloud/' is executable
[Mon Jul 05 06:48:04.633181 2021] [core:crit] [pid 24195:tid 1596945456] (13)Permission denied: [client 192.168.1.168:48652] AH00529: /var/www/nextcloud/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/nextcloud/' is executable
[Mon Jul 05 06:48:27.356631 2021] [core:crit] [pid 24195:tid 1655694384] (13)Permission denied: [client 95.116.230.117:56873] AH00529: /var/www/nextcloud/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/nextcloud/' is executable
[Mon Jul 05 06:48:37.128192 2021] [core:crit] [pid 24195:tid 1647301680] (13)Permission denied: [client 192.168.1.168:48656] AH00529: /var/www/nextcloud/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/var/www/nextcloud/' is executable

but, I have never changed any file or folder permissions, recently 8-|

then the final type AH01071 entries…

[Mon Jul 05 06:49:14.997897 2021] [proxy_fcgi:error] [pid 21630:tid 1580160048] [client 192.168.1.168:48668] AH01071: Got error 'PHP message: {"reqId":"YOKPRn8AAQEAAFR@ukwAAACK","level":2,"time":"2021-07-05T04:49:14+00:00","remoteAddr":"192.168.1.168","user":"--","app":"no app in context","method":"GET","url":"/status.php","message":"Temporary directory /var/www/nextcloud/data/tmp is not present or writable","userAgent":"Mozilla/5.0 (Linux) mirall/2.3.3 (Nextcloud)","version":""}\n'
[Mon Jul 05 06:49:29.382676 2021] [proxy_fcgi:error] [pid 21630:tid 1588552752] [client 95.116.230.117:56879] AH01071: Got error 'PHP message: {"reqId":"YOKPWX8AAQEAAFR@uk4AAACJ","level":2,"time":"2021-07-05T04:49:29+00:00","remoteAddr":"95.116.230.117","user":"--","app":"no app in context","method":"GET","url":"/status.php","message":"Temporary directory /var/www/nextcloud/data/tmp is not present or writable","userAgent":"Mozilla/5.0 (Windows) mirall/3.2.3stable-Win64 (build 20210624) (Nextcloud, windows-10.0.18363 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":""}\n'
[Mon Jul 05 06:49:29.655887 2021] [proxy_fcgi:error] [pid 21630:tid 1529803824] [client 95.116.230.117:56879] AH01071: Got error 'PHP message: {"reqId":"YOKPWX8AAQEAAFR@ulAAAACQ","level":2,"time":"2021-07-05T04:49:29+00:00","remoteAddr":"95.116.230.117","user":"--","app":"no app in context","method":"PROPFIND","url":"/index.php","message":"Temporary directory /var/www/nextcloud/data/tmp is not present or writable","userAgent":"Mozilla/5.0 (Windows) mirall/3.2.3stable-Win64 (build 20210624) (Nextcloud, windows-10.0.18363 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":""}\n'
[Mon Jul 05 06:55:41.368447 2021] [proxy_fcgi:error] [pid 21630:tid 1462637616] [client 95.116.230.117:56939] AH01071: Got error 'PHP message: PHP Warning:  require_once(/var/www/nextcloud/lib/versioncheck.php): failed to open stream: No such file or directory in /var/www/nextcloud/status.php on line 34\nPHP message: PHP Fatal error:  require_once(): Failed opening required '/var/www/nextcloud/lib/versioncheck.php' (include_path='.:/usr/share/php') in /var/www/nextcloud/status.php on line 34\n'
[Mon Jul 05 06:56:04.806632 2021] [proxy_fcgi:error] [pid 2196:tid 1655694384] [client 192.168.1.168:48762] AH01071: Got error 'Primary script unknown\n'
[Mon Jul 05 07:16:24.002093 2021] [proxy_fcgi:error] [pid 2196:tid 1479439408] [client 192.168.1.168:49046] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Class 'OCA\\DAV\\Connector\\Sabre\\ExceptionLoggerPlugin' not found in /var/www/nextcloud/remote.php:61\nStack trace:\n#0 /var/www/nextcloud/remote.php(169): handleException(Object(OC\\HintException))\n#1 {main}\n  thrown in /var/www/nextcloud/remote.php on line 61\n'

...

I might be wrong, but looking into the folder /var/www/nextcloud which seems to be the web-accessible NextCloud folder, there seem to be mixed permissions. I originally thought, all folders and files must be assigned to “www-data” user… but how come this change in ownership?

within the /var/www folder:

pi@RPi-11:~ $ sudo ls -al /var/www
insgesamt 48
drwxr-xr-x 12 root     root     4096 Jul  5 07:16 .
drwxr-xr-x 12 root     root     4096 Nov 13  2018 ..
drwxr-xr-x  2 root     root     4096 Mär  4  2019 html
drwxr-xr-x  8 root     root     4096 Jul  5 06:25 ncp-app
drwx------  2 root     root     4096 Dez 29  2019 ncp-data.aZ28hh
drwx------  2 root     root     4096 Dez  1  2020 ncp-data.GAhIc8
drwx------  2 root     root     4096 Nov 30  2020 ncp-data.obpWXK
drwx------  2 root     root     4096 Dez  2  2020 ncp-data.wZBS92
drwx------  2 root     root     4096 Jul  5 06:50 ncp-data.XGNeoW
drwxr-xr-x  6 www-data www-data 4096 Jul  5 06:25 ncp-previewgenerator
drwxrwx---  8 www-data www-data 4096 Jan  5 12:41 ncp-web
drwxr-x--- 14 www-data www-data 4096 Jul  5 07:08 nextcloud

and within the nextcloud folder:

pi@RPi-11:~ $ sudo ls -al /var/www/nextcloud
insgesamt 168
drwxr-x--- 14 www-data www-data  4096 Jul  5 07:08 .
drwxr-xr-x 12 root     root      4096 Jul  5 07:16 ..
drwxr-x--- 41 www-data www-data  4096 Feb 24 20:11 3rdparty
drwxr-x--- 54 www-data www-data  4096 Jul  5 06:26 apps
-rw-r-----  1 www-data www-data 17234 Feb 24 20:07 AUTHORS
drwxr-x---  2 www-data www-data  4096 Jul  5 06:56 config
-rw-r-----  1 www-data www-data  3893 Feb 24 20:07 console.php
-rw-r-----  1 www-data www-data 34520 Feb 24 20:07 COPYING
drwxr-x--- 22 www-data www-data  4096 Feb 24 20:11 core
-rw-r-----  1 www-data www-data  5083 Feb 24 20:07 cron.php
drwxr-xr-x  3 root     root      4096 Jul  5 07:08 data
-rw-r-----  1 www-data www-data  3122 Mär 14 06:34 .htaccess
-rw-r-----  1 www-data www-data   156 Feb 24 20:07 index.html
-rw-r-----  1 www-data www-data  2960 Feb 24 20:07 index.php
drwxr-x---  6 www-data www-data  4096 Feb 24 20:07 lib
-rw-r-----  1 www-data www-data   283 Feb 24 20:07 occ
drwxr-x---  2 www-data www-data  4096 Feb 24 20:07 ocm-provider
drwxr-x---  2 www-data www-data  4096 Feb 24 20:07 ocs
drwxr-x---  2 www-data www-data  4096 Feb 24 20:07 ocs-provider
-rw-r-----  1 www-data www-data  3102 Feb 24 20:07 public.php
-rw-r-----  1 www-data www-data  5332 Feb 24 20:07 remote.php
drwxr-x---  4 www-data www-data  4096 Feb 24 20:07 resources
-rw-r-----  1 www-data www-data    26 Feb 24 20:07 robots.txt
-rw-r-----  1 www-data www-data  2379 Feb 24 20:07 status.php
drwxr-x---  3 www-data www-data  4096 Feb 27  2019 themes
drwxr-x---  2 www-data www-data  4096 Feb 24 20:08 updater
-rw-r-----  1 www-data www-data   101 Feb 24 20:07 .user.ini
-rw-r-----  1 www-data www-data   382 Feb 24 20:11 version.php

don’t know if this is relevant at all.

Thank you for any help.