Where is the config.php file for Nextcloud?

I would like to modify the config.php file to reset the trusted_domains variable.

Thank you for your help.

Hi @DanielG34

The config.php file is located inside the installation folder of your application, usually at a path like /path/to/nextcloud/config/config.php, although the exact location may vary depending on your setup.

Inside the file, look for the trusted_domains section.

Let us know, cheers.
Sergio Turpín

hello,

I can't find it

I installed Nextcloud with Docker (I'm new to Linux)

thanks

Good morning @DanielG34

It’s normal that you can’t find the file, because in a Docker installation the config.php file resides inside the container, not directly on your host’s filesystem.

The simplest and most direct option for you is to edit the file inside the container:

  1. First we need to know the name of the Nextcloud container; you can find it by running docker ps.
  2. Then, to open the config.php file you can do it by executing this command:
    docker exec -it nombre-de-tu-app nano /var/www/html/config/config.php
  3. Once inside, look for the 'trusted_domains' array and add your domain or IP.
  4. Save the file and then restart the container. To restart it you can run docker restart nombre-de-tu-app.

If you will be modifying your config.php frequently, it’s more convenient to map the file to your host, but for now the above should work as explained.

Kind regards,
Sergio Turpín

Hello

I ran the command
ubuntu@vps-a71e1ee4:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f9c599362f57 nextcloud "/entrypoint.sh apac…" 2 weeks ago Up About an hour 0.0.0.0:8080->80/tcp, [::]:8080->80/tcp nextcloud-app-1
9ab1e8e60e71 mariadb:11 "docker-entrypoint.s…" 2 weeks ago Up About an hour 3306/tcp nextcloud-db-1

What is the container name, please?

I ran the command and got an error

docker exec -it nextcloud-app-1 nano /var/www/html/config/config.php
OCI runtime exec failed: exec failed: unable to start container process: exec: "nano": executable file not found in $PATH
ubuntu@vps-a71e1ee4:~$

Hi @DanielG34

Yes, that error is because the container doesn’t have the nano editor installed.

Try this command:

docker exec -it nextcloud-app-1 vi /var/www/html/config/config.php

Let me know, cheers.
Sergio Turpín

it's the same with vi

ubuntu@vps-a71e1ee4:~$ docker exec -it nextcloud-app-1 vi /var/www/html/config/config.php
OCI runtime exec failed: exec failed: unable to start container process: exec: "vi": executable file not found in $PATH
ubuntu@vps-a71e1ee4:~$

I managed to install nano

I managed to modify the config file to add the domain name

Thank you for your help