For self-hosting enthusiasts and those looking for secure ways to expose their services to the internet, Cloudflare now offers a free and robust option. This solution is perfect for anyone who can’t—or doesn’t want to—tinker with their router’s configuration, or for those who prefer to avoid the complexity of a VPN. With Cloudflare, you can make your locally hosted services accessible on the web without opening any ports on your router, offering a secure and easy-to-manage alternative.
This method used to be restricted and expensive, with pricing based on bandwidth usage. Thankfully, those limitations are no longer an issue. For example, you can now safely make your Plex server or other self-hosted services accessible from the internet. I’ve personally noticed a significant improvement in accessing my local resources—especially much faster access to my server located in Japan from France—thanks to Cloudflare’s optimized infrastructure.
Setting up this solution is not only convenient for secure self-hosting but also fairly simple, even though it does require some basic technical knowledge. In this article, I’ll walk you step-by-step through using this Cloudflare solution—perfect for those who want to expose their services online without the risks of opening ports or dealing with complicated VPN configurations.
You’ll need two main things:
- A personal domain, like itprotutorials.com. If you don’t already have one, I recommend buying one from OVH—for example, a
.ovhdomain, which is very affordable. Note that Cloudflare must be able to fully manage your domain. Using a subdomain only is not supported in this case. - A virtual machine (VM) running Ubuntu 22.04, where you’ll host the services you want to expose (like SSH, for example).
Why a VM? In case your first attempt goes wrong, it’s a safer environment—but the risk is minimal.
You’ll also need a Cloudflare account, which is free.
Step-by-step setup
Start by configuring your domain to be managed by Cloudflare:
- Go to Cloudflare and select “Add a site.” The instructions will vary depending on where you purchased your domain.
- Then, head to https://one.dash.cloudflare.com, go to Access > Tunnel, and create a new tunnel.
- Give your tunnel a name and follow the instructions for Debian by copying the provided code. This code will download, install, and configure the Cloudflare client to connect to their infrastructure.
Once the installation is successful, you’ll see your machine appear in the Connectors section.
Create your first tunnel
For example, if you’ve installed a website on your Ubuntu VM using Apache (apt install apache2 and service apache2 start), your site will be available locally on port 80.
To make this local site accessible on the internet, enter the following details:
- Subdomain:
site1 - Domain: the domain configured with Cloudflare
- Type:
http - URL:
http://localhost:80
Click Save Tunnel. If everything goes well, your site will now be visible on the internet using your configured domain name.
For services using HTTPS with a self-signed certificate, you’ll need to go into the advanced options of Cloudflare to allow this configuration.

Finally, for those less familiar with SSL certificates, I recommend selecting the “Flexible” mode for SSL/TLS encryption in the SSL/TLS menu of Cloudflare (https://dash.cloudflare.com), and enabling the “Always use HTTPS” option in the Edge Certificates section.
