Looking to access your private Nextcloud setup outside of your local network? Let’s discover how to securely do this using the Cloudflare Tunnel. If you’ve got any concerns, remember, our Cloudflare Specialists are always available to assist.
Understanding the Nextcloud Cloudflare Tunnel
Personal Nextcloud setups on home servers have risen in popularity in our digital age. While it’s great within a local network, accessing it externally poses a challenge.
The solution? Cloudflare Tunnel.
The Cloudflare Tunnel offers a free yet robust method to link your server to Cloudflare without revealing your IP address. This ensures you can remotely access Nextcloud without compromising on security.
Step-by-Step Process
- Initiating the Connection: Begin by downloading and installing the cloudflared daemon. This establishes an encrypted channel between Cloudflare and your server.
wget -q https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-amd64.deb
sudo dpkg -i cloudflared-stable-linux-amd64.deb
Bash- Server Authentication: Authenticate your server with Cloudflare.
cloudflared tunnel login
Bash- Tunnel Creation: Formulate a uniquely named tunnel.
cloudflared tunnel create [Your Tunnel Name]
Bash- Configuration: Draft a configuration file. Ensure it incorporates the precise tunnel ID and credentials.
tunnel: [Your Tunnel ID]
credentials-file: /path/to/your/credentials.json
ingress:
- hostname: nextcloud.yourwebsite.com
service: http://your.local.ip.address
- service: http_status:404
BashDNS Configuration: Visit Cloudflare’s dashboard to adjust DNS settings. Add a CNAME record that points to your tunnel ID. Multiple services on one tunnel? Create distinct CNAME entries for each.
Managing Your Tunnel
- Service Installation: The tunnel should always be active. Install it as a service.
sudo cloudflared service install
Bash- Service Management: Enable the Cloudflare service for consistent background running and auto-start upon booting.
sudo systemctl start cloudflared
sudo systemctl enable cloudflared
Bash- Configuration Updates: If you tweak the configuration, restart the service.
sudo systemctl restart cloudflared
BashTroubleshooting: Occasionally, post-setup, you might encounter the “Access through untrusted domain” issue. Resolve it by:
- Navigating to your Nextcloud’s config.php file.
- Incorporating your new domain into the
trusted_domains
list.
'trusted_domains' =>
array (
0 => 'localhost',
1 => 'your.local.ip.address',
2 => 'nextcloud.yourwebsite.com',
),
Bash