Nextcloud does not recognize trusted domain

Hi everyone,

ya…I know there is tons of questions about that in the web but I did not find a proper answer…so, ya, I have issues with the trusted domains:

I stuck to the guideline here:

so long story short: I intent to run nextcloud on unbuntu-live-server 18.04 on virtualbox 6.1 (which runs on a lubuntu 20.10 but I guess that does not make a difference, or does it?)

on the server, I got the IP by using ip a | grep inet (which is the same like in ifconfig) and I added it to the config.php file by using sudo nextcloud.occ config:system:set trusted_domains 1 --value=

And if I look at the config.php it is neatly written there too.

However, if I open the browser using, the nextcloud page is displayed but the little munchkin sais that its not a trusted domain.

Elsewhere I have read that the log file of the server could give some insights…well, sorry about that, but where can I find them?

Happy about any kind of hint

Hello @Thomas_Jakob ,

welcome to the community.
The forum offers plenty of related entries. Please see the search function at top right.

Newbie bonus:

Indeed, I got a quick solution! It is all about snap. Does not like to give other applications much freedom. So you have to use snap to change tings:

sudo snap run nextcloud.occ config:system:set trusted_domains 1 --value=your.fancy.domain

After you do that, then restart nextcloud:

sudo snap restart nextcloud

Then everything should just work.

I hope this helps.

You can also check that value with:

sudo snap run nextcloud.occ config:system:get trusted_domains 1

For example, running:

sudo snap run nextcloud.occ config:system:get trusted_domains 0

probably returns “localhost”.

So that is the deal. The guide above is incomplete concerning trusted_domains. For all those who face the same issues as I did :wink:

Please complete it and why not writing about snap in your first topic :wink:

I have the same problem of not recognizing the trusted domain. I’ve tried editing the config.php file or running the command

su - www-data -s /bin/bash -c 'php /var/www/html/n2/occ config:system:set trusted_domains 2'

but it keeps showing the untrusted domain page.

If i query the system with the command
su - www-data -s /bin/bash -c 'php /var/www/html/n2/occ config:system:get trusted_domains'
I get the correct list of domains but on the second one it doesn’t work.
NextCloud version 22.2.5

what could be the problem ?

Thank you

root@iZwz92bor1grj51dzggxi5Z:/data/wwwroot/default/nextcloud# su - www-data -s /bin/bash -c ‘php /data/wwwroot/default/nextcloud/occ config:system:set trusted_domains 1’
No directory, logging in with HOME=/
Cannot write into “config” directory!
This can usually be fixed by giving the web server write access to the config directory.

But, if you prefer to keep config.php file read only, set the option “config_is_read_only” to true in it.
See Configuration Parameters — Nextcloud latest Administration Manual latest documentation

what’s wrong ? I also have the untrusted domain problem. It’s so disturbingly!

Hello @brioglade,

welcome to the community of Nextcloud.

Are you sure your user is www-data? The path looks like you are on a shared hosting service, or?

What happens if you use get in of set?

I keep having the same problem with version 24.0.4 .
Although the config:system:get trusted_domains command shows the two trusted domains, if I try to connect to the second one I always get the untrusted domain message