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.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF