HowTo: Add a new trusted domain

this answer is pure horror.

with at least some kind of knowledge about security you wouldnt recommend to use a ,blacklist" system! no way around whitelists!!!

I get here but not sure if it is written well :confused:

paste in this file config.php this line

  'trusted_domains' =>

array (
0 => ‘yourip’,
1 => ‘yourdomain.example’,
),

My understanding is:

  1. You normally only add node(s) inside your LAN as trusted. So they can access through HTTP.
  2. When you access through HTTPS - SSL encryption from outside, there is no-need to add trusted domain.

Am I correct? Thanks.

No, please see

https://docs.nextcloud.com/server/20/admin_manual/configuration_server/config_sample_php_parameters.html?highlight=trusted_domains#default-parameters

Ich möchte fĂŒr trusted_domains die Datei
/snap/nextcloud/current/htdocs/config/config.php
editieren. Beim Speichern der Datei erscheint:
Cannot save file [Dismiss]

Ich bin root und die Datei ist: - rw-r-r root:root config.php

Hello @Helmut52,

welcome to the community of Nextcloud.

Please use the search function next time.
It would have brought you to the following page:

i am using nextcloud 21 un Centos 8. i did run this command below:

[root@nc1 nextcloud]# sudo -u apache php occ config:system:set trusted_domains 2 --value=mydomain.com
System config value trusted_domains => 2 set to string mydomain.com
[root@nc1 nextcloud]# systemctl restart httpd

but still the same error still persist. to verify it, here is the config.php file !

config|428x500

restarted the apache daemon, problem still persist

Hi there, I am new to nextcloud and still trying to learn as much as I can from linux.

Could someone explain how I can edit nextcloud’s config file on unraid? I managed to do it for editing the ports unraid uses by physically plugging in the boot drive to my laptop and editing the config file there, but would this also work to add nextcloud trusted domains?

Thanks in advance!

Yes, but I am sure there are easier ways to do that. Never used unraid myself but please see Home | Unraid Docs

1 Like

Does anything need to be added to the trusted domains list in order to allow the Android app client to connect to Nextcloud? I have my FQDN and it works fine for the Windows desktop client and from browsers (on Windows or Android) but I cannot get the Android app to connect via the FQDN.

If the desktop is connected using the exact same name, then it’s already in the list, and doesn’t need to be added.
Seems like something wrong with the Nextcloud app on the device, since the browser seems to work there. Edit: Found your thread where you discuss this problem.

1 Like

To find a file (say, config.php) on linux I use:
sudo find / -name config.php

Newbie here. I was able to find the location of the file with “sudo find / -name config.php”. But I can’t open the nextcloud folder to get to the file (authorization issue i guess). What can I do about it?

Hey , i also need help. I am using ngrok to create a url for my local host. once the url is created i added it to the trusted domain but it is still not working.

If you use cPanel, default location is

cPanel > File manager > public_html > config.php

then just click edit in file manager and add IP, domain, subdomain or all together.

 'trusted_domains' =>
  array (
    0 => '192.168.0.29',
    1 => 'cloudamo.com',
  ),

if you installed nextcloud with the Ubuntu server iso 22.4 then the file will be at,
Sudo vim /var/snap/nextcloud/current/nextcloud/config/config.php press ‘insert’ on your keyboard and edit the file, look for ‘trusted domains’ then add your domain. press escape on keyboard then save and quit :wq
You can now log in from your trusted domain.