Accessing server from outside of LAN

Please can someone advise how I can access my server (on a PC Running FreeNAS) from outside of my LAN. If I use my external IP Address instead of my local address I get an error “cannot connect to server at this time”

You have to add the IP to yoour trusted domains configuration in config php.

You can edtit config php with
nano /var/nextcloud/config/config.php
(path has to be corrected to your local configuration)

‘trusted_domains’ =>
array (
demo.example.org’,
‘77.77.77.77’,
),

Your list of trusted domains that users can log into. Specifying trusted domains prevents host header poisoning. Do not remove this, as it performs necessary security checks.

https://docs.nextcloud.com/server/11/admin_manual/configuration_server/config_sample_php_parameters.html?highlight=config

Hi Joachim,

I confess that although I am IT literate, I have very little Linux experience. I have installed FreeNAS 9.3 because it is largely GUI based. I just added the plugin for NextCloud. It’s installed in a Jail called Nextcloud_1.

If I use the script option within this directory it says Nano not found. The shell opens in folder root@nextcloud_1

If I try to drill down the folders to find config.php I can’t find it anywhere.

Appreciate your help,
John

Sounds like your issue is firewall, not NC configuration or trusted domains; if you can access your NC server within the LAN all you’d need to do is port forward 80/443 (whichever you have setup) from the router/firewall to the FreeNAS jail.

I don’t use FreeNAS so can’t help there, but for what you want within the scope of your request you shouldn’t need to edit any config file manually; when you access the server for the first time from outside the network using a domain name it’ll offer you a GUI prompt to add the new trusted domain. That’ll only fail if permissions aren’t correctly set.

Hi Jason,

Thanks so much! Bit of port forwarding works wonders.

Regards,
John

John

I’ve set up port forwarding on my router using my nextclous ip address and port (details I use to login in my LAN) but unfortunately it’s still not working. Anything I need to look at?

Hey @fopoku2k2, have you tried to port forward to any different port than 80 and 443? Some ISPs may block these ports. Try to forward the nextcloud port 80 and 443 to for example 8080 and 1443 and see if those work. If they don’t work either, then the problem is on your network. Also make sure you don’t have any firewall on your machine blocking the ports. Also take a look if you have some kind of a firewall installed which is blocking the ports. Can you send a screenshot of your port forwarding settings? (Sanitized of course, if necessary).