Changes made to config.php and Trusted_Domains not working

After days of prepping my server backend, I upgraded to Nextcloud 29.0.2 and was fully prepared to have to modify my config.php to resolve the security warning as noted here: After upgrade from 28 to 29 I have "Data directory and your files are probably accessible from the Internet"

Unfortunately, once I modified the file and restarted Apache, the warning persisted. I then rebooted my entire server, and no change. So I created a clone of my server, and rolled back my snapshot prior to 29.0.2. Now working with my clone, I’m changing my config.php, but it doesn’t appear to be working.

Since I’ve not changed my firewall rule to expose this clone to port 443, I have to access it from the IP. Which is fine, it’s a good test. But, every time I try to access the IP, I’m hit with the warning that I can’t access it through an untrusted domain:

Thing is, I’ve modified the config.php file. I used OCC config to even tell me the parameters:

~$ sudo -u www-data php /var/www/nextcloud/occ config:system:get trusted_domains
MyDomain
MyDomain
192.x.x.x
~$

For reasons unknown to me, my actual domain is listed twice. I’ve left it, but even tried removing it, and of course no change.

So, am I modifying the correct config.php file? I’m using Nano to modify it - is this wrong? Why are the changes I’m making not apparently working?

Nextcloud version (eg, 29.0.5): 29.0.2
Operating system and version (eg, Ubuntu 29.04): Ubuntu 22.04 LTS
Apache or nginx version (eg, Apache 2.4.25): 2.4.52
PHP version (eg, 8.3): 8.3

The issue you are facing: changes made to config.php appear to not work

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. navigate to /var/www/nextcloud/config and modify config.php
  2. Save changes to config.php
  3. Restart Apache or entire server

For some reason the formatting of my config.php isn’t quite accurate when I copy/paste it, so I hope it’s readable

?php
$CONFIG = array (
‘passwordsalt’ => ‘xxxxxxxxx’,
‘secret’ => ‘xxxxxxxxxxx’,
‘trusted_domains’ =>
array (
0 => ‘MyDomain’,
1 => ‘MyDomain’,
2 => ‘192.x.x.x’,
),
‘datadirectory’ => ‘/mnt/ncdata’,
‘dbtype’ => ‘pgsql’,
‘version’ => ‘29.0.2.2’,
‘overwrite.cli.url’ => ‘’,
‘dbname’ => ‘nextcloud_db’,
‘dbhost’ => ‘localhost’,
‘dbport’ => ‘’,
‘dbtableprefix’ => ‘oc_’,
‘dbuser’ => ‘xxxxxx’,
‘dbpassword’ => ‘xxxxx’,
‘installed’ => true,
‘instanceid’ => ‘xxxxxxx’,
‘upgrade.disable-web’ => true,
‘log_type’ => ‘file’,
‘logfile’ => ‘/var/log/nextcloud/nextcloud.log’,
‘loglevel’ => ‘2’,
‘log.condition’ =>
array (
‘apps’ =>
array (
0 => ‘admin_audit’,
),
),
‘mail_smtpmode’ => ‘smtp’,
‘remember_login_cookie_lifetime’ => ‘1800’,
‘log_rotate_size’ => ‘10485760’,
‘trashbin_retention_obligation’ => ‘auto, 60’,
‘versions_retention_obligation’ => ‘auto, 180’,
‘activity_expire_days’ => ‘120’,
‘versions_retention_obligation’ => ‘auto, 180’,
‘activity_expire_days’ => ‘120’,
‘simpleSignUpLink.shown’ => false,
‘memcache.local’ => ‘\OC\Memcache\Redis’,
‘filelocking.enabled’ => true,
‘memcache.distributed’ => ‘\OC\Memcache\Redis’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘redis’ =>
array (
‘host’ => ‘/var/run/redis/redis-server.sock’,
‘port’ => 0,
‘timeout’ => 0.5,
‘dbindex’ => 0,
‘password’ => ‘xxxxxxxxxxx’,
),
‘default_phone_region’ => ‘us’,
‘logtimezone’ => ‘US/Central’,
‘htaccess.RewriteBase’ => ‘/’,
‘enable_previews’ => true,
‘enabledPreviewProviders’ =>
array (
11 => ‘OC\Preview\PNG’,
12 => ‘OC\Preview\JPEG’,
13 => ‘OC\Preview\GIF’,
14 => ‘OC\Preview\BMP’,
16 => ‘OC\Preview\MP3’,
17 => ‘OC\Preview\TXT’,
),
‘preview_max_x’ => 2048,
‘preview_max_y’ => 2048,
‘jpeg_quality’ => 60,
‘maintenance’ => false,
‘has_rebuilt_cache’ => true,
‘mail_smtpsecure’ => ‘ssl’,
‘mail_sendmailmode’ => ‘smtp’,
‘mail_smtphost’ => ‘mail.com’,
‘mail_smtpport’ => ‘465’,
‘mail_smtpauthtype’ => ‘PLAIN’,
‘mail_smtpauth’ => 1,
‘mail_smtpauthtype’ => ‘PLAIN’,
‘mail_smtpauth’ => 1,
‘mail_from_address’ => ‘xxxx’,
‘mail_domain’ => ‘mail.com’,
‘mail_smtpname’ => ‘@mail.com’,
‘mail_smtppassword’ => ‘xxxxxxxxxxxxx’,
‘memories.exiftool_no_local’ => true,
‘memories.vod.path’ => ‘/var/www/nextcloud/apps/memories/bin-ext/go-vod-amd64’,
‘memories.vod.ffmpeg’ => ‘/usr/bin/ffmpeg’,
‘memories.vod.ffprobe’ => ‘/usr/bin/ffprobe’,
‘updater.release.channel’ => ‘stable’,
‘maintenance_window_start’ => 1,
‘memories.db.triggers.fcu’ => true,
‘app_install_overwrite’ =>
array (
0 => ‘otpmanager’,
1 => ‘news’,
),
);

1 Like

I got this working by using OCC command to add a trusted server value. occ config:system:set trusted_domains 1 --value=x.x.x.x

Likewise, I can remove a entry by using occ config:system:delete trusted_domains 1

Sadly it does not resolve my issue with Nextcloud 29 saying that my data and files are accessible from the internet.

2 Likes