Internal Server Error after successful command-line installation

After successful command-line installation, the Nextcloud instance initially appeared as expected in the browser. Soon, however, it only showed the following “Internal Server Error” in the browser with no related log entries. That is still the case except that now none of the assets/styles are rendered, only the error text appears:

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.

I’ve checked nextcloud.log, Apache’s access_log and error_log, and even a php error log (logErrors=On in php.ini).

Version info
Nextcloud version (eg, 12.0.2): 17.0.1.1
Operating system and version (eg, Ubuntu 17.04): FreeBSD 11.3
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4
PHP version (eg, 7.1): 7.2

This issue has now occurred following two command-line installations. After running into this the first time, I wiped out the installation and installed from scratch a second time.

Here’s my config/config.php without the sensitive lines:

  'trusted_domains' =>                                                                                        
  array (                                                                                                     
    0 => 'mycloud.example.com',                                                                              
  ),                                                                                                          
  'datadirectory' => '/path/to/data',                                                               
  'log_type' => 'file',                                                                                       
  'logfile' => '/path/to/data/nextcloud.log',                                                       
  'logfilemode' => 0660,                                                                                      
  'loglevel' => 0,                                                                                            
  'dbtype' => 'mysql',                                                                                        
  'version' => '17.0.1.1',                                                                                    
  'overwrite.cli.url' => 'https://mycloud.example.com/nextcloud',                                                   
  'memcache.local' => '\OC\Memcache\Memcached',                                                               
  'installed' => true,                                                                                        
  'twofactor_enforced' => 'true',                                                                             
  'twofactor_enforced_groups' =>                                                                              
  array (                                                                                                     
  ),                                                                                                          
  'twofactor_enforced_excluded_groups' =>                                                                     
  array (                                                                                                     
  ),                                                                                                          
  'maintenance' => false,  

I enabled Memcached because other threads about this error suggest the issue has to do with memcache. However, the docs say, with emphasis, “A memcache is not required and you may safely ignore the warning if you prefer.

Apache’s access_log shows that the 500 error code is coming from nextcloud/status.php . However, the error/exception details are not getting written to nextcloud.log – its permissions are +rw for user and group (660).

The URL of the installation is of the form “<hostname>/nextcloud”. The .htaccess in the web server’s document root directory (corresponding to “https://<hostname>/”) is:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule ^\.well-known/host-meta /nextcloud/public.php?service=host-meta [QSA,L]
  RewriteRule ^\.well-known/host-meta\.json /nextcloud/public.php?service=host-meta-json [QSA,L]
  RewriteRule ^\.well-known/webfinger /nextcloud/public.php?service=webfinger [QSA,L]
  RewriteRule ^\.well-known/nodeinfo /nextcloud/public.php?service=nodeinfo [QSA,L]
  RewriteRule ^\.well-known/carddav /nextcloud/remote.php/dav/ [R=301,L]
  RewriteRule ^\.well-known/caldav /nextcloud/remote.php/dav/ [R=301,L]
</IfModule>
<IfModule mod_headers.c>
  Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>

The .htaccess in the Nextcloud root directory (corresponding to “https://<hostname>/nextcloud”) is the default one that was installed, I haven’t modified it.