Access A Nextcloud Server From Outside Your Home Network

I’ve talked a bit about installing Nextcloud on various devices in recent posts, but thus far I’ve not explained how you can access your server from outside your home network.

Thankfully, it’s relatively easy to do.

Setting up a Dynamic DNS Address

Unless you have a static IP address on your home network you’re going to need to use a DDNS service to map a (free) internet URL to your public IP.

Most routers come with a feature for doing this, so refer to the guidance in the routers user guide or from your ISP.

If your router doesn’t support DDNS then you’ll need to install a DDNS on a device on your network.

I recommend using NOIP’s free DDNS service, you can register for it on their website and they provide full instructions on how to set it up.

Setting up Port Forwarding

You’ll also need to configure your router so that it allows traffic from outside your network to reach your Nextcloud server.

The specifics of how to do this will differ from router to router, so I again encourage you to look up the specific information on hot to do it from the user guide or from your ISP.

The specifics of what we need to achieve are to forward ports 443 (for HTTPS) and 80 (for HTTP) traffic to the IP address of your server on your home network.

Allowing Access to Nextcloud

From here it’s a case of modifying the Nextcloud config file to allow connections from outside your network.

In a Linux instance of Nextcloud open a Terminal window and navigate to your nextcloud folder, for instance:

cd /var/www/html/nextcloud/config

Note: Your folder structure may vary, if you’re not sure then you can change directory incrementally and then use the “ls” command from within the folder to see what subfolders are there.

Within the config folder is a config file, so:

nano config.php

Inside this file is a section similar to as follows called “trusted domains”:

'trusted_domains' =>
   array (
     0 => '',    

What this section means is that the domains listed will be permitted to access your Nextcloud server. Only your home network domain is shown, so only devices local to your network can join.

What we need to do is add a second line which permits access from the WAN side of your home router, so the text becomes:

'trusted_domains' =>
   array (
     0 => '',
     1 => 'your.ddns.domain',

Where ‘your.ddns.domain’ is the DDNS you registered to map to your public IP address.

Press ctrl+O to save the file, then ctrl+X to exit

Configuring Clients

Lastly, you’ll need to reconfigure your Nextcloud clients with the DDNS name as the location of your Nextcloud server, as apposed to its local IP address.

So, open the client and click on the Account button, then remove:

Then click Account again and click Add new:

Click Log in, and then in the next window add your DDNS address:

Click Next, and you’ll follow the same process as when you originally set up your Nextcloud client, only now you should be able to access your Nextcloud server from anywhere in the world, provided you have an Internet connection.

NOTE: It’s important to consider that most domestic network connections only have very slow upload speeds, so you may well find it takes longer than usual for data to replicate, particularly if you’ve not turned on a device in a while and there’s lots of changes. I’d recommend making this initial connection while on your home network, so that data is transfered a lot quicker.

3 thoughts on “Access A Nextcloud Server From Outside Your Home Network”

Leave a Reply