Internal Server Error after Update cleaned out my config.php

Nextcloud version (eg, 12.0.2): 18.0.0.1
Operating system and version (eg, Ubuntu 17.04): Arch Linux (Kernel 5.4.13)
Apache or nginx version (eg, Apache 2.4.25): nginx 1.17.1
PHP version (eg, 7.1): 7.3

After updating the nextcloud to 18.0.0.10 via the web updater my config.php file was empty. I tried recreating it as best as I could, reinstalled the Nextcloud to get a new passwordsalt and secret and I can succesfully login. After login i get “Internal Server Error”. My nextcloud.log shows - apart from bad signatures and encryption errors for the old user - the 2 errors that are shown below and I can’t figure out what causes them.

config.php

$CONFIG = array (
  'instanceid' => '***',
  'passwordsalt' => '***',
  'secret' => '***',
  'trusted_domains' => 
  array (
    0 => 'cloud.********.com',
  ),
  'datadirectory' => '/var/nextcloud/',
  'dbtype' => 'mysql',
  'dbname' => 'nextcloud',
  'dbuser' => 'nextcloud',
  'dbpassword' => '****',
  'installed' => true,
  'theme' => '',
  'loglevel' => 2,
  'maintenance' => false,
  'version' => '18.0.0.10',
  'appstoreenabled' => 'true',
  'apps_path' => 
  array (
    0 => 
    array (
      'path' => '/usr/share/webapps/nextcloud/apps',
      'url' => '/apps',
      'writable' => true,
    ),
  ),
  'mysql.utf8mb4' => true,
  'overwrite.cli.url' => 'https://cloud.*******.com',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
);

Nextcloud.log (only 2 relevant requests)

{"reqId":"lY66hM2SBGC2jk4qZJLH","level":3,"time":"2020-01-21T10:06:57+00:00","remoteAddr":"IP_HERE","user":"pfonks2","app":"PHP","method":"GET","url":"/apps/files/","message":"Undefined variable: server at /usr/share/webapps/nextcloud/apps/metadata/lib/AppInfo/Application.php#31","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0","version":"18.0.0.10"}
{"reqId":"lY66hM2SBGC2jk4qZJLH","level":3,"time":"2020-01-21T10:06:57+00:00","remoteAddr":"IP_HERE","user":"pfonks2","app":"index","method":"GET","url":"/apps/files/","message":{"Exception":"Exception","Message":"Call to a member function getContentSecurityPolicyManager() on null","Code":0,"Trace":[{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/App.php","line":125,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files\\Controller\\ViewController"},"index"]},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Files\\Controller\\ViewController","index",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"files.view.index"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"_route":"files.view.index"}]},{"file":"/usr/share/webapps/nextcloud/lib/private/Route/Router.php","line":299,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"_route":"files.view.index"}]},{"file":"/usr/share/webapps/nextcloud/lib/base.php","line":1008,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/files/"]},{"file":"/usr/share/webapps/nextcloud/index.php","line":38,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":109,"Previous":{"Exception":"Error","Message":"Call to a member function getContentSecurityPolicyManager() on null","Code":0,"Trace":[{"file":"/usr/share/webapps/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":247,"function":"OCA\\Metadata\\AppInfo\\{closure}","class":"OCA\\Metadata\\AppInfo\\Application","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/usr/share/webapps/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":73,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[[{"__class__":"Closure"},{"__class__":"Closure"},{"__class__":"Closure"},{"__class__":"Closure"},{"__class__":"Closure"},{"__class__":"Closure"},{"__class__":"Closure"},{"__class__":"Closure"},{"__class__":"Closure"},{"__class__":"Closure"}],"*** sensitive parameter replaced ***","*** sensitive parameter replaced ***"]},{"file":"/usr/share/webapps/nextcloud/lib/private/EventDispatcher/EventDispatcher.php","line":80,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":["*** sensitive parameter replaced ***","*** sensitive parameter replaced ***"]},{"file":"/usr/share/webapps/nextcloud/lib/private/EventDispatcher/SymfonyAdapter.php","line":63,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":["*** sensitive parameter replaced ***","*** sensitive parameter replaced ***"]},{"file":"/usr/share/webapps/nextcloud/apps/files/lib/Listener/LegacyLoadAdditionalScriptsAdapter.php","line":51,"function":"dispatch","class":"OC\\EventDispatcher\\SymfonyAdapter","type":"->","args":["*** sensitive parameter replaced ***","*** sensitive parameter replaced ***"]},{"file":"/usr/share/webapps/nextcloud/lib/private/EventDispatcher/ServiceEventListener.php","line":76,"function":"handle","class":"OCA\\Files\\Listener\\LegacyLoadAdditionalScriptsAdapter","type":"->","args":[{"__class__":"OCA\\Files\\Event\\LoadAdditionalScriptsEvent"}]},{"file":"/usr/share/webapps/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":247,"function":"__invoke","class":"OC\\EventDispatcher\\ServiceEventListener","type":"->","args":[{"__class__":"OCA\\Files\\Event\\LoadAdditionalScriptsEvent"},"OCA\\Files\\Event\\LoadAdditionalScriptsEvent","*** sensitive parameter replaced ***"]},{"file":"/usr/share/webapps/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":73,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[[{"__class__":"Closure"},{"__class__":"Closure"},{"__class__":"Closure"},{"__class__":"Closure"},{"__class__":"Closure"},{"__class__":"Closure"}],"OCA\\Files\\Event\\LoadAdditionalScriptsEvent",{"__class__":"OCA\\Files\\Event\\LoadAdditionalScriptsEvent"}]},{"file":"/usr/share/webapps/nextcloud/lib/private/EventDispatcher/EventDispatcher.php","line":80,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[{"__class__":"OCA\\Files\\Event\\LoadAdditionalScriptsEvent"},"OCA\\Files\\Event\\LoadAdditionalScriptsEvent"]},{"file":"/usr/share/webapps/nextcloud/lib/private/EventDispatcher/SymfonyAdapter.php","line":63,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":["OCA\\Files\\Event\\LoadAdditionalScriptsEvent",{"__class__":"OCA\\Files\\Event\\LoadAdditionalScriptsEvent"}]},{"file":"/usr/share/webapps/nextcloud/apps/files_sharing/list.php","line":44,"function":"dispatch","class":"OC\\EventDispatcher\\SymfonyAdapter","type":"->","args":["OCA\\Files\\Event\\LoadAdditionalScriptsEvent",{"__class__":"OCA\\Files\\Event\\LoadAdditionalScriptsEvent"}]},{"file":"/usr/share/webapps/nextcloud/apps/files/lib/Controller/ViewController.php","line":121,"args":["/usr/share/webapps/nextcloud/apps/files_sharing/list.php"],"function":"include"},{"file":"/usr/share/webapps/nextcloud/apps/files/lib/Controller/ViewController.php","line":259,"function":"renderScript","class":"OCA\\Files\\Controller\\ViewController","type":"->","args":["files_sharing","list.php"]},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":170,"function":"index","class":"OCA\\Files\\Controller\\ViewController","type":"->","args":["","",null,false]},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files\\Controller\\ViewController"},"index"]},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/App.php","line":125,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files\\Controller\\ViewController"},"index"]},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Files\\Controller\\ViewController","index",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"files.view.index"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"_route":"files.view.index"}]},{"file":"/usr/share/webapps/nextcloud/lib/private/Route/Router.php","line":299,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"_route":"files.view.index"}]},{"file":"/usr/share/webapps/nextcloud/lib/base.php","line":1008,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/files/"]},{"file":"/usr/share/webapps/nextcloud/index.php","line":38,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/usr/share/webapps/nextcloud/apps/metadata/lib/AppInfo/Application.php","Line":31},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0","version":"18.0.0.10"}

Fixed after reading https://help.nextcloud.com/t/internal-error-after-app-update/68737

If anyone in the future has the problem that they get ‘Invalid signature’ or something alike after reinstalling the nextcloud application and thus changing the private key, I solved that issue by disabling the encryption module and running occ encryption:decrypt-all. WARNING: This will possibly permanently wreck your files, so I hope if you need to do this you have a backup!