Can't enable primary object store -> Internal Server Error, but no log entry

Nextcloud version: 23.0.7snap1
Operating system and version: Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25):
PHP version (eg, 7.4): 8.0.21

The issue you are facing:

Server is working fine with filesystem data storage.
I tested my S3 object storage with the external storage app and it works. But I want to use it as primary storage.
I added the 'object store' => ... section as explained in the guide, but then I get an internal server error message, saying “More details can be found in the server log.” but I found nothing in the log. I looked in nextcloud.log (in the location given in config.php), apache_errors.log, php_errors.log but found no log entry for this error (i.e. at this time).

The output of your Nextcloud log in Admin > Logging:

no new log entries when I hit the webserver and it gives the error

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

<?php
$CONFIG = array (
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/snap/nextcloud/current/htdocs/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/snap/nextcloud/current/nextcloud/extra-apps',
      'url' => '/extra-apps',
      'writable' => true,
    ),
  ),
  'supportedDatabases' =>
  array (
    0 => 'mysql',
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/tmp/sockets/redis.sock',
    'port' => 0,
  ),
  'log_type' => 'file',
  'logfile' => '/var/snap/nextcloud/current/logs/nextcloud.log',
  'logfilemode' => 416,
  'passwordsalt' => '********',
  'secret' => '*************',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '*************',
    2 => '*************',
    3 => '*************',
  ),
  'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '23.0.7.2',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '***********',
  'installed' => true,
  'instanceid' => '*******************',
  'maintenance' => false,
  'allow_local_remote_servers' => true,
  'loglevel' => 4,
  'objectstore' => array(
    'class' => '\\OC\\Files\\ObjectStore\\S3',
    'arguments' => array(
      'hostname' => '**************',
      'port' => 80,
      'use_ssl' => false,
      'bucket' => '****************',
      'autocreate' => true,
      'key'    => '*****************',
      'secret' => '**********************',
      'region' => '*****************',
      // required for some non Amazon S3 implementations
      'use_path_style' => true,
    ),
  ),
);

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

no new log entry also here

When in “AWS S3”-mode I have the distinct impression log files are attempted to be written to S3 also!

Try adding this to your config and check if something interesting gets written there

  'loglevel' => 2, // or something more/less extensive..
  'log_type' => 'file', // syslog
  'syslog_tag' => 'Nextcloud',
  'logfile' => '/ [folder] /log_nextcloud/nextcloud.log',
  'log_rotate_size' => 100 * 1024 * 1024, // 100 Mb

PS: IMHO this should be a default setting when AWS S3 is used…