Chiari Truth

Unraveling the Physical and Emotional Complexities of Life with Arnold-Chiari Malformation and Posterior Fossa Arachnoid Cysts

Author: CW-AI

Overview

In this guide, we’ll walk through setting up a Cloudflare Tunnel on a fresh Ubuntu Studio 24.04.4 installation. This approach will allow access to a domain name (like example.ai) without exposing your IP address, utilizing Cloudflare’s secure tunneling capabilities. This setup works well for domains with multiple subdomains, all served locally without needing to enter your server’s IP.


Step 1: Install cloudflared

  1. Start by downloading the cloudflared package to your server:
   wget -q https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
   sudo dpkg -i cloudflared-linux-amd64.deb

Step 2: Authenticate with Cloudflare

  1. Run the login command and follow the prompts to authenticate your server with Cloudflare:
   cloudflared tunnel login
  1. This command will open a browser window for logging into your Cloudflare account. Once logged in, your server is authorized with Cloudflare and ready to set up a tunnel.

Step 3: Create the Tunnel

  1. Create a new tunnel, giving it a memorable name:
   cloudflared tunnel create example-tunnel
  1. Cloudflare will generate a unique tunnel ID. Note this ID, as it will be used in configuration.

Step 4: Create a Config File for the Tunnel

  1. Navigate to /etc/cloudflared/ and create a config.yml file:
   tunnel: <your_tunnel_UUID>
   credentials-file: /home/yourusername/.cloudflared/<tunnel_UUID>.json

   ingress:
     - hostname: example.ai
       service: http://localhost:80
     - hostname: sub1.example.ai
       service: http://localhost:8081
     - hostname: sub2.example.ai
       service: http://localhost:8082
     - hostname: sub3.example.ai
       service: http://localhost:8083
     - hostname: sub4.example.ai
       service: http://localhost:8084
     - hostname: sub5.example.ai
       service: http://localhost:8085
     - service: http_status:404

Replace <your_tunnel_UUID> with your tunnel ID and set each service field to the respective port for each application you wish to expose through the subdomain.


Step 5: Map DNS Records to the Tunnel

  1. Use the following commands to associate each subdomain with the tunnel, allowing Cloudflare to handle DNS routing:
   cloudflared tunnel route dns example-tunnel example.ai
   cloudflared tunnel route dns example-tunnel sub1.example.ai
   cloudflared tunnel route dns example-tunnel sub2.example.ai
   cloudflared tunnel route dns example-tunnel sub3.example.ai
   cloudflared tunnel route dns example-tunnel sub4.example.ai
   cloudflared tunnel route dns example-tunnel sub5.example.ai

Step 6: Run the Tunnel

  1. To start the tunnel and activate the connection to your domain:
   cloudflared tunnel run example-tunnel
  1. To keep the tunnel running persistently as a service:
   cloudflared service install
   sudo systemctl start cloudflared
   sudo systemctl enable cloudflared

Summary

By setting up your domain and subdomains through Cloudflare’s tunnel, you can serve your applications securely, with Cloudflare handling all DNS routing and protecting your server’s IP. This configuration supports up to five subdomains while keeping the main domain secure under Cloudflare’s tunnel management.

With these steps, your Ubuntu server is now fully configured to host your domain without any IP exposure.