Linux Format

Self-hosting Nextcloud

-

accessing Nextcloud on a local network doesn’t take any extra steps apart from installati­on. However, if you need to access your personal cloud from anywhere on the planet you’ll need to jump through a few hoops.

The first order of business is to get a domain name and tie it to a fixed IP address of your Nextcloud server. Most residentia­l ISPS dole out random IP addresses that change dynamicall­y every time you reset the router. Unless you can keep yours on forever, it’s best to use a dynamic DNS service. These services automatica­lly update the DNS records when the IP address of your device is changed dynamicall­y by the internet provider. You can find many such services for free, such as FREEDNS and DUCKDNS. Some router manufactur­ers such as D-link also offer dynamic DNS services for free to their customers.

Once you’ve sorted out a dynamic DNS, you’ll then have to set up port forwarding to ensure the requests that arrive at your router are routed to the Nextcloud server. For this you’ll have to log in to your router’s administra­tion page and look for the settings labelled ‘Port Forwarding’ or ‘Virtual Server’. Once you’ve located the settings just make sure that traffic arriving on port 80 and 443 are routed to the IP address of the machine running Nextcloud.

Many residentia­l ISPS also block popular incoming ports for security reasons. You can use the online Port Forwarding Tester tool at www.yougetsign­al.com/ tools/open-ports to check whether your ISP blocks traffic over port 80 and 443. In case it does, you can modify Nextcloud to communicat­e over a custom port. For instance, if your ISP has closed port 443 you can set up your cloud to communicat­e over port 8443.

To do this, you’ll first have to modify a couple of files. First open /etc/apache2/ports.conf file in a text editor and change the port numbers to your custom port. Then edit /etc/apache2/sitesavail­able/nextcloud_ssl_domain_self_signed.conf to change the first line from to

< Virtualhos­t *:8443> . When you’re done, restart the Apache web server with sudo systemctl restart apache2.service .

You should now be able to access your Nextcloud server running inside a VM on your network from a computer outside your local network, using the domain name you specified while setting up the dynamic DNS service. There’s one last step before you can access your cloud. By default the Nextcloud inside the VM will not accept requests from the domain name you’ve set up, unless it’s added to the list of trusted domains. For this, edit /var/www/nextcloud/ config/config.php and scroll down to the trusted_ domains setting. The values under the setting are in an array and you can add your custom domain in the same format, such as:

‘trusted_domains’ => array (

0 => ‘localhost’,

1 => ‘192.168.0.50’,

2 => ‘nextcloud’,

3 => ‘geekybodhi.dlinkddns.com’,

We have added the last entry, which points to the custom domain name we set up with D-link’s DDNS service. Save the file when you’re done; changes to this file don’t need the web server to be restarted.

 ??  ?? The one downside to using a custom SSL port is that you’re not able to fetch a certificat­e from the Let’s Encrypt certificat­e. authority.
The one downside to using a custom SSL port is that you’re not able to fetch a certificat­e from the Let’s Encrypt certificat­e. authority.

Newspapers in English

Newspapers from Australia