Bad Gateway 502 when logging out

Nextcloud version : 21.0.0
Operating system and version : Ubuntu 20.04
Apache or nginx version : nginx 1.18.0
PHP version : 8.0.2

The issue I’m facing:

Everytime a user tries to log out, he get’s a Bad Gateway 502 error from nginx. Reload the page and you will move on to the login site again. The URL while you see the Bad Gateway error is the xxxx/logout?requesttoken=4xeln9w5CqO62caJHQmwxiIyCTUVXYclPq7zMasmFZI%3D%3AyFSV%2FaVPY9mLsofYLjjni3dKeGZzCtBMbvSZXO4eIds%3D

Is this the first time I’ve seen this error? : Yes, this Instance is the first one I’m using with nginx and that’s the first time that happens.

Steps to replicate it:

  1. Log out

The output of your Nextcloud log in Admin > Logging:

NONE

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

$CONFIG = array (
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => 'xxx',
  ),
  'logfile' => '/var/log/nextcloud.log',
  'memcache.local' => '\OC\Memcache\APCu',
  'datadirectory' => '/var/www/ncdata/cloud',
  'dbtype' => 'mysql',
  'version' => '21.0.0.18',
  'overwrite.cli.url' => 'xxx',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxx',
  'dbpassword' => 'xxx',
  'installed' => true,
  'default_phone_region' => 'DE',
    'default_locale' => 'de_DE',
  'mail_from_address' => 'cloud',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'xxx',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'xxx',
  'mail_smtpname' => 'xxx',
  'mail_smtppassword' => 'xxx',
  'mail_smtpsecure' => 'ssl',
  'mail_smtpport' => '465',
  'overwriteprotocol' => 'https',
  'logtimezone' => 'Europe/Berlin',
  'filelocking.enabled' => 'true',
  'memcache.locking' => '\OC\Memcache\Redis',
  'redis' => array (
     'host' => '/var/run/redis/redis-server.sock',
     'port' => 0,
     'timeout' => 0.0,
      ),
);

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

2021/03/05 11:28:45 [error] 3086#3086: *133 FastCGI sent in stderr: "PHP message: {"reqId":"zLyimrsck7IWttG4S0lQ","level":3,"time":"2021-03-05T11:28:45+01:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"GET","url":"/logout?requesttoken=CySKetgufx7W9GB3FucmfY5XkZhUxMapGI66X1BjRMY%3D%3AYXfbQ7xtS2acjS0cYoZtJ6Eh0KwAnrDCVuiOJxwAa6k%3D","message":{"Exception":"Error","Message":"session_start(): Ignoring session_start() because a session is already active at /var/www/nextcloud/lib/private/Session/Internal.php#207","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"function":"session_start"},{"file":"/var/www/nextcloud/lib/private/Session/Internal.php","line":207,"function":"call_user_func_array"},{"file":"/var/www/nextcloud/lib/private/Session/Internal.php","line":217,"function":"invoke","class":"OC\\Session\\Internal","type":"->"},{"file":"/var/www/nextcloud/lib/private/Session/Internal.php","line":107,"function":"startSession","class":"OC\\Session\\Internal","type":"->"},{"file":"/var/www/nextcloud/lib/private/Sess...PHP message: {"reqId":"zLyimrsck7IWttG4S0lQ","level":3,"time":"2021-03-05T11:28:45+01:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"GET","url":"/logout?requesttoken=CySKetgufx7W9GB3FucmfY5XkZhUxMapGI66X1BjRMY%3D%3AYXfbQ7xtS2acjS0cYoZtJ6Eh0KwAnrDCVuiOJxwAa6k%3D","message":{"Exception":"Error","Message":"fopen(/var/log/nextcloud.log): Failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Log/File.php#85","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Log/File.php","line":85,"function":"fopen"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":371,"function":"write","class":"OC\\Log\\File","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":220,"function":"writeLog","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":131,"function":"log","class":"OC\\Log","type":"->"},{"file":
2021/03/05 11:28:45 [error] 3086#3086: *133 upstream sent too big header while reading response header from upstream, client: xxxx, server: xxxx, request: "GET /logout?requesttoken=CySKetgufx7W9GB3FucmfY5XkZhUxMapGI66X1BjRMY%3D%3AYXfbQ7xtS2acjS0cYoZtJ6Eh0KwAnrDCVuiOJxwAa6k%3D HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.0-fpm.sock:", host: "xxxx"
2021/03/05 11:30:05 [error] 3086#3086: *133 FastCGI sent in stderr: "PHP message: {"reqId":"OezotXIl7EQBk2qJ1fAz","level":3,"time":"2021-03-05T11:30:05+01:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"PUT","url":"/ocs/v2.php/apps/user_status/api/v1/user_status/status","message":{"Exception":"Error","Message":"fopen(/var/log/nextcloud.log): Failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Log/File.php#85","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Log/File.php","line":85,"function":"fopen"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":371,"function":"write","class":"OC\\Log\\File","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":220,"function":"writeLog","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":131,"function":"log","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","line":83,"function":"critical","class":"OC\\Log","type":...PHP message: {"reqId":"OezotXIl7EQBk2qJ1fAz","level":3,"time":"2021-03-05T11:30:05+01:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"PUT","url":"/ocs/v2.php/apps/user_status/api/v1/user_status/status","message":{"Exception":"Error","Message":"chmod(): Operation not permitted at /var/www/nextcloud/lib/private/Log/File.php#87","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Log/File.php","line":87,"function":"chmod"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":371,"function":"write","class":"OC\\Log\\File","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":220,"function":"writeLog","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":131,"function":"log","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","line":83,"function":"critical","class":"OC\\Lo
2021/03/05 11:30:05 [error] 3086#3086: *133 FastCGI sent in stderr: "/var/www/nextcloud/lib/private/Log/File.php","line":87,"function":"chmod"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":371,"function":"write","class":"OC\\Log\\File","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":220,"function":"writeLog","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":131,"function":"log","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","line":70,"function":"critical","class":"OC\\Log","type":"->"},{"function":"onShutdown","class":...PHP message: {"reqId":"OezotXIl7EQBk2qJ1fAz","level":3,"time":"2021-03-05T11:30:05+01:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"PUT","url":"/ocs/v2.php/apps/user_status/api/v1/user_status/status","message":"chmod(): Operation not permitted at /var/www/nextcloud/lib/private/Log/File.php#87","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36","version":"21.0.0.18"}" while reading response header from upstream, client: xxxx, server: xxxx, request: "PUT /ocs/v2.php/apps/user_status/api/v1/user_status/status HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.0-fpm.sock:", host: "xxxx"
2021/03/05 11:30:07 [error] 3086#3086: *133 FastCGI sent in stderr: "PHP message: {"reqId":"WGUZjZC3bcysBJ4kVxDw","level":3,"time":"2021-03-05T11:30:07+01:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"PUT","url":"/ocs/v2.php/apps/user_status/api/v1/user_status/message/custom?format=json","message":{"Exception":"Error","Message":"fopen(/var/log/nextcloud.log): Failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Log/File.php#85","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Log/File.php","line":85,"function":"fopen"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":371,"function":"write","class":"OC\\Log\\File","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":220,"function":"writeLog","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":131,"function":"log","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","line":83,"function":"critical","clas...PHP message: {"reqId":"WGUZjZC3bcysBJ4kVxDw","level":3,"time":"2021-03-05T11:30:07+01:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"PUT","url":"/ocs/v2.php/apps/user_status/api/v1/user_status/message/custom?format=json","message":{"Exception":"Error","Message":"chmod(): Operation not permitted at /var/www/nextcloud/lib/private/Log/File.php#87","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Log/File.php","line":87,"function":"chmod"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":371,"function":"write","class":"OC\\Log\\File","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":220,"function":"writeLog","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":131,"function":"log","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","line":83,"function":"criti
2021/03/05 11:30:07 [error] 3086#3086: *133 FastCGI sent in stderr: "og\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Log/File.php","line":87,"function":"chmod"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":371,"function":"write","class":"OC\\Log\\File","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":220,"function":"writeLog","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":131,"function":"log","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","line":70,"function":"critical","class":"OC\\Log","type":"->"},{"function":"...PHP message: {"reqId":"WGUZjZC3bcysBJ4kVxDw","level":3,"time":"2021-03-05T11:30:07+01:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"PUT","url":"/ocs/v2.php/apps/user_status/api/v1/user_status/message/custom?format=json","message":"chmod(): Operation not permitted at /var/www/nextcloud/lib/private/Log/File.php#87","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36","version":"21.0.0.18"}" while reading response header from upstream, client: xxxx, server: xxxx, request: "PUT /ocs/v2.php/apps/user_status/api/v1/user_status/message/custom?format=json HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.0-fpm.sock:", host: "xxxx"
2021/03/05 11:30:50 [error] 3086#3086: *133 FastCGI sent in stderr: "PHP message: {"reqId":"VLw9rkICvI2KzpFb9YyF","level":3,"time":"2021-03-05T11:30:50+01:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"GET","url":"/logout?requesttoken=6%2FLfn9ZDjzg9sG%2BlLhgcvQfLwG3Pc3%2BJYjY3GooiPQ8%3D%3Aj6Ps64Qlw2BuxF3IajNL8UiyuSSoPBfDUm9GNeQWc2I%3D","message":{"Exception":"Error","Message":"session_start(): Ignoring session_start() because a session is already active at /var/www/nextcloud/lib/private/Session/Internal.php#207","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"function":"session_start"},{"file":"/var/www/nextcloud/lib/private/Session/Internal.php","line":207,"function":"call_user_func_array"},{"file":"/var/www/nextcloud/lib/private/Session/Internal.php","line":217,"function":"invoke","class":"OC\\Session\\Internal","type":"->"},{"file":"/var/www/nextcloud/lib/private/Session/Internal.php","line":107,"function":"startSession","class":"OC\\Session\\Internal","type":"->"},{"file":"/var/www/nextcloud/lib/privat...PHP message: {"reqId":"VLw9rkICvI2KzpFb9YyF","level":3,"time":"2021-03-05T11:30:50+01:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"GET","url":"/logout?requesttoken=6%2FLfn9ZDjzg9sG%2BlLhgcvQfLwG3Pc3%2BJYjY3GooiPQ8%3D%3Aj6Ps64Qlw2BuxF3IajNL8UiyuSSoPBfDUm9GNeQWc2I%3D","message":{"Exception":"Error","Message":"fopen(/var/log/nextcloud.log): Failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Log/File.php#85","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Log/File.php","line":85,"function":"fopen"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":371,"function":"write","class":"OC\\Log\\File","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":220,"function":"writeLog","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":131,"function":"log","class":"OC\\Log","type":"->"},{"
2021/03/05 11:30:50 [error] 3086#3086: *133 upstream sent too big header while reading response header from upstream, client: xxxx, server: xxxx, request: "GET /logout?requesttoken=6%2FLfn9ZDjzg9sG%2BlLhgcvQfLwG3Pc3%2BJYjY3GooiPQ8%3D%3Aj6Ps64Qlw2BuxF3IajNL8UiyuSSoPBfDUm9GNeQWc2I%3D HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.0-fpm.sock:", host: "xxxx"
2021/03/05 11:37:33 [error] 3086#3086: *2701 FastCGI sent in stderr: "PHP message: {"reqId":"yWXGCEWtFB13h3505dy8","level":3,"time":"2021-03-05T11:37:33+01:00","remoteAddr":"xxxx","user":"xxxx","app":"PHP","method":"GET","url":"/settings/admin","message":{"Exception":"Error","Message":"The \"Symfony\\Component\\Translation\\PluralizationRules\" class is deprecated since Symfony 4.2. at /var/www/nextcloud/3rdparty/symfony/translation/PluralizationRules.php#38","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/3rdparty/symfony/translation/PluralizationRules.php","line":38,"function":"trigger_error"},{"file":"/var/www/nextcloud/lib/private/L10N/L10N.php","line":226,"function":"get","class":"Symfony\\Component\\Translation\\PluralizationRules","type":"::"},{"file":"/var/www/nextcloud/lib/private/L10N/L10NString.php","line":70,"function":"OC\\L10N\\{closure}","class":"OC\\L10N\\L10N","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/L10...PHP message: {"reqId":"yWXGCEWtFB13h3505dy8","level":3,"time":"2021-03-05T11:37:33+01:00","remoteAddr":"xxxx","user":"xxxx","app":"PHP","method":"GET","url":"/settings/admin","message":{"Exception":"Error","Message":"The \"Symfony\\Component\\Translation\\PluralizationRules\" class is deprecated since Symfony 4.2. at /var/www/nextcloud/3rdparty/symfony/translation/PluralizationRules.php#38","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/3rdparty/symfony/translation/PluralizationRules.php","line":38,"function":"trigger_error"},{"file":"/var/www/nextcloud/lib/private/L10N/L10N.php","line":226,"function":"get","class":"Symfony\\Component\\Translation\\PluralizationRules","type":"::"},{"file":"/var/www/nextcloud/lib/private/L10N/L10NString.php","line":70,"function":"OC\\L10N\\{closure}","class":"OC\\L10N\\L10N","type":"->","args":["*** sensitive parameters replaced 
2021/03/05 11:37:33 [error] 3086#3086: *2701 FastCGI sent in stderr: "PHP message: {"reqId":"yWXGCEWtFB13h3505dy8","level":3,"time":"2021-03-05T11:37:33+01:00","remoteAddr":"xxxx","user":"xxxx","app":"PHP","method":"GET","url":"/settings/admin","message":{"Exception":"Error","Message":"fopen(/var/log/nextcloud.log): Failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Log/File.php#85","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Log/File.php","line":85,"function":"fopen"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":371,"function":"write","class":"OC\\Log\\File","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":220,"function":"writeLog","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":131,"function":"log","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","line":70,"function":"critical","class":"OC\\Log","type":"->"},{"function":"onShut...PHP message: {"reqId":"yWXGCEWtFB13h3505dy8","level":3,"time":"2021-03-05T11:37:33+01:00","remoteAddr":"xxxx","user":"xxxx","app":"PHP","method":"GET","url":"/settings/admin","message":{"Exception":"Error","Message":"chmod(): Operation not permitted at /var/www/nextcloud/lib/private/Log/File.php#87","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Log/File.php","line":87,"function":"chmod"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":371,"function":"write","class":"OC\\Log\\File","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":220,"function":"writeLog","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":131,"function":"log","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","line":70,"function":"critical","class":"OC\\Log","type":"->"},{"functi
2021/03/05 11:37:36 [error] 3086#3086: *2701 FastCGI sent in stderr: "PHP message: {"reqId":"lFmnfPpSvoYltiyCgVkH","level":3,"time":"2021-03-05T11:37:35+01:00","remoteAddr":"xxxx","user":"xxxx","app":"PHP","method":"GET","url":"/settings/ajax/checksetup","message":{"Exception":"Error","Message":"The \"Symfony\\Component\\Translation\\PluralizationRules\" class is deprecated since Symfony 4.2. at /var/www/nextcloud/3rdparty/symfony/translation/PluralizationRules.php#38","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/3rdparty/symfony/translation/PluralizationRules.php","line":38,"function":"trigger_error"},{"file":"/var/www/nextcloud/lib/private/L10N/L10N.php","line":226,"function":"get","class":"Symfony\\Component\\Translation\\PluralizationRules","type":"::"},{"file":"/var/www/nextcloud/lib/private/L10N/L10NString.php","line":70,"function":"OC\\L10N\\{closure}","class":"OC\\L10N\\L10N","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/p" while reading response header from upstream, client: xxxx, server: xxxx, request: "GET /settings/ajax/checksetup HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.0-fpm.sock:", host: "xxxx"
2021/03/05 11:37:36 [error] 3086#3086: *2701 FastCGI sent in stderr: "PHP message: {"reqId":"lFmnfPpSvoYltiyCgVkH","level":3,"time":"2021-03-05T11:37:36+01:00","remoteAddr":"xxxx","user":"xxxx","app":"PHP","method":"GET","url":"/settings/ajax/checksetup","message":{"Exception":"Error","Message":"fopen(/var/log/nextcloud.log): Failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Log/File.php#85","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Log/File.php","line":85,"function":"fopen"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":371,"function":"write","class":"OC\\Log\\File","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":220,"function":"writeLog","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":131,"function":"log","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","line":70,"function":"critical","class":"OC\\Log","type":"->"},{"functio...PHP message: {"reqId":"lFmnfPpSvoYltiyCgVkH","level":3,"time":"2021-03-05T11:37:36+01:00","remoteAddr":"xxxx","user":"xxxx","app":"PHP","method":"GET","url":"/settings/ajax/checksetup","message":{"Exception":"Error","Message":"chmod(): Operation not permitted at /var/www/nextcloud/lib/private/Log/File.php#87","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Log/File.php","line":87,"function":"chmod"},{"file":"/var/www/nextcloud/lib/private/Log.php","l" while reading upstream, client: xxxx, server: xxxx, request: "GET /settings/ajax/checksetup HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.0-fpm.sock:", host: "xxxx"
2021/03/05 11:37:36 [error] 3086#3086: *2701 FastCGI sent in stderr: "ine":371,"function":"write","class":"OC\\Log\\File","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":220,"function":"writeLog","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":131,"function":"log","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","line":70,"function":"critical","class":"OC\\Log","type":"->"},{"function":"onShutdown","class":"OC\\Log\\Error...PHP message: {"reqId":"lFmnfPpSvoYltiyCgVkH","level":3,"time":"2021-03-05T11:37:36+01:00","remoteAddr":"xxxx","user":"xxxx","app":"PHP","method":"GET","url":"/settings/ajax/checksetup","message":"chmod(): Operation not permitted at /var/www/nextcloud/lib/private/Log/File.php#87","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36","version":"21.0.0.18"}" while reading upstream, client: xxxx, server: xxxx, request: "GET /settings/ajax/checksetup HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.0-fpm.sock:", host: "xxxx"
2021/03/05 11:39:00 [error] 3086#3086: *2701 FastCGI sent in stderr: "PHP message: {"reqId":"ZHMXzUTPAPiMBxbInmkl","level":3,"time":"2021-03-05T11:39:00+01:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"GET","url":"/logout?requesttoken=4xeln9w5CqO62caJHQmwxiIyCTUVXYclPq7zMasmFZI%3D%3AyFSV%2FaVPY9mLsofYLjjni3dKeGZzCtBMbvSZXO4eIds%3D","message":{"Exception":"Error","Message":"session_start(): Ignoring session_start() because a session is already active at /var/www/nextcloud/lib/private/Session/Internal.php#207","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"function":"session_start"},{"file":"/var/www/nextcloud/lib/private/Session/Internal.php","line":207,"function":"call_user_func_array"},{"file":"/var/www/nextcloud/lib/private/Session/Internal.php","line":217,"function":"invoke","class":"OC\\Session\\Internal","type":"->"},{"file":"/var/www/nextcloud/lib/private/Session/Internal.php","line":107,"function":"startSession","class":"OC\\Session\\Internal","type":"->"},{"file":"/var/www/nextcloud/lib/private/Se...PHP message: {"reqId":"ZHMXzUTPAPiMBxbInmkl","level":3,"time":"2021-03-05T11:39:00+01:00","remoteAddr":"xxxx","user":"--","app":"PHP","method":"GET","url":"/logout?requesttoken=4xeln9w5CqO62caJHQmwxiIyCTUVXYclPq7zMasmFZI%3D%3AyFSV%2FaVPY9mLsofYLjjni3dKeGZzCtBMbvSZXO4eIds%3D","message":{"Exception":"Error","Message":"fopen(/var/log/nextcloud.log): Failed to open stream: Permission denied at /var/www/nextcloud/lib/private/Log/File.php#85","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Log/File.php","line":85,"function":"fopen"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":371,"function":"write","class":"OC\\Log\\File","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":220,"function":"writeLog","class":"OC\\Log","type":"->"},{"file":"/var/www/nextcloud/lib/private/Log.php","line":131,"function":"log","class":"OC\\Log","type":"->"},{"fil
2021/03/05 11:39:00 [error] 3086#3086: *2701 upstream sent too big header while reading response header from upstream, client: xxxx, server: xxxx, request: "GET /logout?requesttoken=4xeln9w5CqO62caJHQmwxiIyCTUVXYclPq7zMasmFZI%3D%3AyFSV%2FaVPY9mLsofYLjjni3dKeGZzCtBMbvSZXO4eIds%3D HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.0-fpm.sock:", host: "xxxx"

After hours of searching I got a good hint.
If somebody else has this problem, here’s the fix.

Open your nginx.conf file at /etc/nginx/nginx.conf
Inside the http { … } part paste the following:

fastcgi_buffers 16 16k; 
fastcgi_buffer_size 32k;

save and restart nginx with

service nginx restart

That did the trick for me.