$schemamarkup = get_post_meta(get_the_ID(), 'schemamarkup', true); if(!empty($schemamarkup)) { echo $schemamarkup; }

Connect a Domain to Your Local Apache Server via Cloudflare Tunnel

November 10, 2025 | By the+gnu+linux+evangelist.

Connecting Domain to Localhost

  1. 2. Authenticate with Cloudflare

    Now link your server to your Cloudflare account:

    cloudflared tunnel login

    This command opens a browser window where you can log in and select your domain.
    A new certificate file will be stored in ~/.cloudflared/cert.pem.

  2. 3. Create the Tunnel

    Next, create a new named tunnel:

    cloudflared tunnel create mytunnel

    This generates a JSON credentials file inside ~/.cloudflared/.

  3. 4. Create the Config File

    Now set up the configuration file to expose your local HTTP service:

    sudo nano /etc/cloudflared/config.yml

    Paste this minimal setup:

    tunnel: mytunnel
    credentials-file: /root/.cloudflared/<TUNNEL_ID>.json
    
    ingress:
      - hostname: example.com
        service: http://localhost:80
      - service: http_status:404
  4. 5. Run the Tunnel

    Finally, start your Cloudflare Tunnel:

    cloudflared tunnel run mytunnel

    Your HTTP site at localhost:80 is now securely available at https://example.com via Cloudflare.

  5. 6. Optional: Auto-start on Boot

    Enable automatic start at boot using systemd:

    sudo systemctl enable --now cloudflared

Contents