Editing /etc/hosts to satisfy 'trusted_domains' in config.php rather than set up local DNS

So I’m playing around with the NC AIO docker on an old laptop whose display is wonky so I’m working on it remotely. Both the NC server and and my main laptop (client) are behind my home router. I was struggling to access NC webpage from my client. I saw several posts about this and most suggested setting a local DNS, which sounds like more of a pain than it’s worth given the simplicity of my current set up.
Instead of setting up a DNS, I have simply added a line to my client’s /etc/hosts file that looks like

computer.local 10.0.0.XX

and then added computer to the trusted_domains list on the server.

It seems to work, but I’m wondering if I’m doing something stupid with this set up that I don’t realize. Or, alternatively, is this a useful solution that deserves mentioning at the start of a thread on this topic?

I wouldn’t say it’s stupid, and if it works for you and you only access your Nextcloud from desktop PCs inside you LAN, I’d say it’s ok doing it like this.

But what if one of those PCs is a laptop which you also want to use to access your Nextcloud from outside your LAN? Or what about mobile phones and tablets, where you normally can’t edit the hosts file? :wink:

2 Likes

Yeah, the phones are a potential hiccup. As for the laptop, I used a different name to access the server locally, so that shouldn’t be an issue. But the phones…