How do I edit the config.php file on a nextcloud box?

Hi all. Just got the nextcloud box, and it looks promising, but my only access at this point is the web browser. Everything I read for how to enable SSL and tructed domains talks about editing a config.php file. How do I get to that file??

Bob S

config.php is located in nextcloud/config/config.php. If you installed nextcloud in /var/www, then the full path would be /var/www/nextcloud/config/config.php
During first setup in that directory you’ll only see config.sample.php which you should copy and paste as config.php and work from there.

Unfotunately that isn’t so easy in the ncbox as its installed with snap

i suggest you check the snap command on ssh

first do a snap list so you see which packages are installed

with snap refresh you can update your stuff but if you do that with nextcloud and the gap is too big, it will crash.

with snap info nextcloud you see the available commands:

  • nextcloud.disable-https
  • nextcloud.enable-https
  • nextcloud.manual-install
  • nextcloud.mysql-client
  • nextcloud.mysqldump
  • nextcloud.occ

i suggest you use the snap command to enable https because its better if its register that to the packet manager.

I have installed:

installed: 11.0.3snap1 (1288) 162MB -

so my config file which is applies should be this:

/var/snap/nextcloud/1288/nextcloud/config/config.php

there you can add the domain.

What is snap?? I searched for it in Apps but did not find it. I am running on a mac so I suppose I can ssh into it, but I don’t know what credentials to use. Do I have to sudo to gain write access to these files?

I’m a complete noob to Linux, although I have worked extensively with the mac and windows CLI.

Bob S

did you work with the terminal app too in os x? Its basically a BSD but there are much similarities. Yes you need to ssh to it, sudo and snap is a cli command on the box.

OK, I was able to connect a monitor and keyboard, figure out the user and password, which is ubuntu:ubuntu and I was able to edit the config.php file using sudo vi. But the problem was NOT that my windows domains were not trusted. The problem was that the FQDN being used for the name of the device, (nextcloud.local) is a bonjour address, and is not discernable to a windows network! What I had to do was add a new zone to my DNS called local, and create an A record for nextcloud.local. The only way for this to really be plug and play for Windows is to register a netBIOS name with the current wins server, or master browser if there isn’t one.

Anyway, I was able to get Windows workstations to talk to it.

I attempted to ssh into it but logins fail. I am using ssh -i -u ubuntu. I set the password when I had a monitor and keyboard set up on it, and I used the password multiple times successfully, and it is a standard password I use for such things on a regular basis so I know it is correct. Yet it fails the login attempts. Any ideas?

Actually I am using ssh nextcloud.local -i -u ubuntu.

Hi, Newbie here :slight_smile:
I have Next Cloud installed on a Pi3 and i need to add a trusted_domain.
However despite searching the entire file structure i cannot find a config.php file :frowning:
Any suggestions welcome.

T.J.

You may use nextcloud-snaps included occ-command sudo nextcloud.occ and add a trusted domain like described here:
https://docs.nextcloud.com/server/13/admin_manual/configuration_server/occ_command.html#setting-an-array-configuration-value

EDIT: sorry @johnsoap, I just realised that you might not use nextcloud-snap - thought you are because you posted in this snap related thread. How did you install Nextcloud?

Hello!

I am a new user of Nextcloud and its the first time i installed Ubuntu Server 18 (latest version) I installed Ubuntu server 18 and chosed Nextcloud. Now it is installed like a “snap”. It is impossible for me to edit this document via MC or jed using sudo mc or any other editing tool in ubuntu 18 server environment.

I tried with Nano, Jed, MC but this folder is “Read-Only”? Having this problem helped me developing my Ubuntu skills so i guess there is always some positive when there is a problem because then we learn, right! :slight_smile:

I reinstalled Ubuntu Server 18 with the same results. Anyone know how to make the folder “writeable”

I do not want to use CHMOD 777 to that directory. I really would like to get some help with this. Thanks!!

MC= Midnight Commander (great tool for edit files via Ubuntu server environment)

1 Like

What exactly do you want to change in config.php?

With nextcloud-snap this folder is not writeable, but nextcloud-snap comes with included cli-utilities which may be a help for you:

1 Like

Thanks for your answer! :slight_smile:

I need to add my public IP to Domain Trust so i can reach it external. I have port forward from my Router to my external ip and now it is locked and it says i need to change the php config file.

Watch this Print Screen, it says in swedish, i need to add it to trusted domains.

1aaaa

Have a look at your trusted_domains with:

sudo nextcloud.occ config:system:get trusted_domains

And add a new trusted_domain with:

sudo nextcloud.occ config:system:set trusted_domains X
--value=subdomain.example.com

As X use (amount of trusted_domains +1). Have a look here:
https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/occ_command.html#setting-an-array-configuration-value

2 Likes

Thank you, i will try this asap and get back to you with results.

Best regards
Jim Larsson

Hello!

That worked excellent. :slight_smile:

Thank you so much for your help!

FYI, if you want to edit the config by hand, the writable version is located in /var/snap/nextcloud/current/nextcloud/config/config.php.

4 Likes

Thank you, :slight_smile:

1 Like