Bobcares

Nextcloud Cloudflare Tunnel

by | Aug 22, 2023

Learn how to set up Nextcloud Cloudflare Tunnel from our experts. Our Cloudflare Support team is here to help you with your questions and concerns.

All About Nextcloud Cloudflare Tunnel

In today’s world, setting up our own private Nextcloud installation on a home server has become a popular choice. However, if we want to access it from outside our local network, it becomes a tad bit more difficult.

All About Nextcloud Cloudflare Tunnel

Fortunately, we can achieve this without exposing your server’s IP address to the world. This is where the Cloudflare Tunnel comes in handy.

Cloudflare Tunnel is a powerful and free service that offers a secure way to directly connect our server to Cloudflare. At the same time, it keeps our IP address hidden. This service helps us access our Nextcloud installation remotely.

How it works

  1. First, we have to install the cloudflared daemon on your server. This daemon will set up an encrypted tunnel between our server and Cloudflare.

    $ wget -q https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-amd64.deb
    $ sudo dpkg -i cloudflared-stable-linux-amd64.deb

  2. After installation, it is time to authenticate our server with Cloudflare by running the tunnel login command.

    $ cloudflared tunnel login

  3. Next, we have to generate a tunnel with a unique name. For example:

    $ cloudflared tunnel create nextcloud

    Here we have to replace nextcloud with the unique tunnel name.

  4. Then, we have to create a configuration file and define our tunnel settings. We have to include the correct tunnel ID and credentials file gotten from the tunnel creation command.

    tunnel: 01f0928b-6a11-4254-854c-4173b5b74f2e
    credentials-file: /home/janne/.cloudflared/01f0928b-6a11-4254-854c-4173b5b74f2e.json
    ingress:
    - hostname: nextcloud.ourdomain.com
    service: http://192.168.1.22
    - service: http_status:404

  5. Next, we have to configure our DNS settings on the Cloudflare web dashboard by adding a CNAME record. We have to point the CNAME target to <our-tunnel-id>.cfargotunnel.com. If we have multiple services using the same tunnel, we have to create separate CNAME entries for each hostname.

How to Start and Manage the Tunnel

  1. First, we have to install the tunnel as a service to make sure it is always active:

    $ sudo cloudflared service install

  2. Now, we can start and enable the Cloudflare service so that it runs in the background and starts automatically upon server boot.

    $ sudo systemctl start cloudflared
    $ sudo systemctl enable cloudflared

  3. If we make changes to the configuration file, we have to restart the service for the changes to take effect.

    $ sudo systemctl restart cloudflared

After setting up the Cloudflare Tunnel, we may run into the “Access through untrusted domain” error. We can resolve this with these steps:

  1. First, we have to find and edit the config.php file in our Nextcloud installation directory.
  2. Then, we must add our new domain to the trusted_domains list in the config.php file.

    'trusted_domains' =>
    array (
    0 => 'localhost',
    1 => '192.168.1.22',
    2 => 'nextcloud.yourdomain.com',
    ),

After the above steps, we will be able to access our Nextcloud server securely through our configured domain.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

In summary, our Support Techs demonstrated how to set up Nextcloud Cloudflare Tunnel.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

2 Comments

  1. Jan Novopacký

    Hello,

    I recently followed your article on setting up Cloudflare Tunnel for Nextcloud, and it’s been incredibly helpful. However, I’m encountering a couple of issues within the Nextcloud admin panel:

    “Your web server is not properly set up to resolve ‘/.well-known/caldav’. Further information can be found in the documentation.”
    “Your web server is not properly set up to resolve ‘/.well-known/carddav’. Further information can be found in the documentation.”
    I’ve followed all the steps in your guide but still see these errors. Could you provide any advice or additional steps to resolve these issues?

    Thank you!

    Reply
    • Hiba Razak

      Hi,
      Our experts can help you with the issue.we will be happy to talk to you through our live chat(click on the icon at right-bottom).

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.