Installation on headless server

I’m attempting to set up nextcloud on a headless server using Snap. I’ve followed the very useful instructions in this blog post:

so I now have nextcloud running on the server. The only problem is that I can’t access the server from my Desktop machine using a browser (see message below).

I can ssh into the server and run nextcloud.occ commands, no problem. I have set up an admin account and moved the data directory to an external SSD, all according to the instructions. I have set the IP of the Desktop machine and my router as trusted domains but quite evidently nextcloud isn’t trusting them when I try to reach the server over htpps.

I can reach the server using the lynx browser installed on the server but it’s a text-only browser with no javascript. I really don’t want to install a desktop environment just in order to finish setting up nextcloud.

Any ideas/suggestions would be most welcome.


Access through untrusted domain

Please contact your administrator. If you are an administrator, edit the “trusted_domains” setting in config/config.php like the example in config.sample.php.

Hi @frderek

since the TLS connection is terminated by your webserver, Nextcloud shouldn’t have anything to do with it. Can you make sure your trusted_domain block in your configuration is properly formatted? It should look like this:

$CONFIG = array (
  'instanceid' => 'oc984842984298o',
  'trusted_domains' => 
  array (
    0 => 'your.domain.tld',

Now you say that you have added the IP of your desktop and router there but that is not what this field is for. The trusted_domains works on the server side. Say, you have a server that has IP, and a domain points to it: cloud.mydomain.tld. You want Nextcloud to only respond when accessed through the domain, not via the IP directly - so you add your domain to the trusted_domain list but leave the IP out.

In short: put the IP or domain of your server there, not of your clients.


As an alternative you could try out the Nextcloud VM:

Then everything like that will be taken care of automatically.

I really can’t thank you enough. That’s exactly what my config file
looked like. What I hadn’t realised was that I needed to access the
server from OUTSIDE my own LAN. I’ve now added the domains to be trusted
from OUTSIDE my LAN and access it via the internet! it works!

1 Like

Glad I could help! :slight_smile: