n Snap installations, the config.php file is actually generated from the Snap configuration. You can't directly edit config.php in a Snap installation. Instead, you need to use the Nextcloud command-line interface (CLI) provided by the Snap package to configure Nextcloud.

Here's how you can set trusted domains using the Nextcloud CLI in a Snap installation:

bash Copy code sudo nextcloud.occ config:system:set trusted_domains 2 --value=munetaka.me:45103 Replace 2 with the appropriate index for your domain in the list of trusted domains if it's different. This command adds munetaka.me:45103 as a trusted domain.

After running this command, verify that the domain has been added to the list of trusted domains:

bash Copy code sudo nextcloud.occ config:system:get trusted_domains Restart Nextcloud to apply the changes:

bash Copy code sudo snap restart nextcloud This should properly configure Nextcloud to accept requests from the specified domain. If you encounter any errors or issues, please let me know!

alexlai@hc4Noble:~$ sudo nextcloud.occ config:system:get trusted_domains 2024/05/04 14:20:27.998478 cmd_run.go:1072: WARNING: cannot create user data directory: failed to verify SELinux context of /root/snap: exec: "matchpathcon": executable file not found in $PATH 192.168.48.239 munetaka.me:45103 munetaka.me

<?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,
  'instanceid' => 'ocktmzjp78j5',
  'passwordsalt' => '2ZfHuWqwZy+zZKp0pII7pgdqON3Oh+',
  'secret' => '5lgkZeOmtIJHkZqIlAdjcSvR+1DC35TGGTo+AsT+lWvb5Ee+',
  'trusted_domains' => 
  array (
    0 => '192.168.48.239',
    1 => 'munetaka.me',
    2 => 'hc4Noble.yushei.net',
  ),
  0 => 
  array (
    'trusted_proxies' => 'https://munetaka.me:45103',
    'overwrite.cli.url' => 'https://munetaka.me:45103',
  ),
  'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '27.1.8.1',
  'overwrite.cli.url' => 'http://192.168.48.239',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'kG0vW58f9kql1zJURcCGZ4XVQitMeIYWBoktQOOcbIZVt3EOvjb8fm6lyUo3JRjt',
  'installed' => true,
  'allow_local_remote_servers' => true,
  'maintenance' => false,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
);

_ GPT,

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, 'instanceid' => 'ocktmzjp78j5', 'passwordsalt' => '2ZfHuWqwZy+zZKp0pII7pgdqON3Oh+', 'secret' => '5lgkZeOmtIJHkZqIlAdjcSvR+1DC35TGGTo+AsT+lWvb5Ee+', 'trusted_domains' => array ( 0 => '192.168.48.239', 1 => 'munetaka.me:45103', 2 => 'hc4Noble.yushei.net', ), 'overwrite.cli.url' => 'https://munetaka.me:45103', 'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data', 'dbtype' => 'mysql', 'version' => '27.1.8.1', 'dbname' => 'nextcloud', 'dbhost' => 'localhost:/tmp/sockets/mysql.sock', 'dbport' => '', 'dbtableprefix' => 'oc_', 'mysql.utf8mb4' => true, 'dbuser' => 'nextcloud', 'dbpassword' => 'kG0vW58f9kql1zJURcCGZ4XVQitMeIYWBoktQOOcbIZVt3EOvjb8fm6lyUo3JRjt', 'installed' => true, 'allow_local_remote_servers' => true, 'maintenance' => false, 'mail_smtpmode' => 'smtp', 'mail_smtpsecure' => 'ssl', 'mail_sendmailmode' => 'smtp', ); ```