How to correctly add extra trusted domain IP to config.php

OS Version: Mac OSX 12.6
Docker Desktop Version: 4.16.2
Nextcloud Image Version: latest

I need to expose Nextcloud server to an extra IP rather than localhost, so I operated step by step like below :

  1. docker cp CONTAINER:/var/www/html/config/config.php ./config.php

  2. Open this config.php in the Mac OSX and add one line under the “trusted domain array”:

array (
    0 => 'localhost:portal_number',
    **1 => 'My.Extra.IP.Address:portal_number',**
  ),
  1. docker cp ./config.php CONTAINER:/var/www/html/config/config.php

But when I restarted the container and typed localhost:portal_number in my browser, it throwed an error like below:

So, how to fix this error, do I need some more steps to refresh this configure file?

Maybe the permissions and/or owner/group of the config.php have been changed.

1 Like

I used ls -al to display permissions of all files inside /config folder. Compared with the nearby file “apps.config.php”, config.php has no “Read” permission for “Others”, so that might be the cause of this error.

After I added “Read” permission with chmod to config.php, it still not worked well. Finally I also added “Write” permission, and it turned to be normal.

Thanks.

Instead of changing the everyone rights, you probably want to change the owner/group of that file back to www-data.

1 Like

Corect - uid 501 means a non-existing user as owner. Group “dialout” also is not correct.
The permissions should be the same as in the entry above as well as owner and group.

The wrong permissions are resut of copying the config.php into the docker container, where uid 501 is different to uid 501 in the host-environment.

1 Like