Convert step-by-step sections to the steps component
This commit is contained in:
@@ -5,17 +5,6 @@ description: Use Cloudflare Tunnels and Zero Trust to expose homelab services wi
|
||||
|
||||
|
||||
:ellipsis{left=0px width=40rem top=10rem blur=140px zIndex=60}
|
||||
# Cloudflare Zero Trust
|
||||
|
||||
::note
|
||||
🎯 __Goals:__
|
||||
|
||||
- Understand the concept of Cloudflare Tunnels
|
||||
- Configure your Cloudflare account
|
||||
- Configure SWAG
|
||||
- Manage multiple tunnels
|
||||
::
|
||||
|
||||

|
||||
|
||||
## Introduction
|
||||
@@ -34,8 +23,7 @@ Simply put, Cloudflare Tunnels allow you to:
|
||||
Here we’ll explain how to integrate SWAG with Cloudflare tunnels.
|
||||
|
||||
::warning
|
||||
|
||||
- __Warning:__
|
||||
__Warning:__
|
||||
- Do not use Cloudflare tunnels to expose a mail server
|
||||
- Do not use Cloudflare tunnels to expose a video service like Jellyfin. Unlike Plex, [Jellyfin has no cloud relay](/serveex/media/jellyfin) and is exposed directly through SWAG in this guide, so make sure it stays behind plain port forwarding rather than a Cloudflare tunnel
|
||||
- Do not use Cloudflare tunnels for the BitTorrent protocol (if you followed [this guide](/serveex/media/qbittorrent), everything is fine)
|
||||
@@ -50,7 +38,7 @@ If you only have one server to protect behind Cloudflare, you can delete all exi
|
||||
|
||||
If you have subdomains pointing to other servers, you can still define them in the DNS zone using A records.
|
||||
|
||||
If you have several servers and tunnels under one domain, [see here](http://192.168.7.80:8005/serveex/cloudflare/#gerer-plusieurs-tunnels-pour-plusieurs-serveurs).
|
||||
If you have several servers and tunnels under one domain, [see here](#managing-multiple-tunnels-for-multiple-servers).
|
||||
|
||||
### API Key
|
||||
|
||||
@@ -85,7 +73,8 @@ SWAG supports two Docker Mods:
|
||||
|
||||
These two mods, merged into the SWAG container, require some configuration.
|
||||
|
||||
### Tunnel Configuration
|
||||
::steps{level="3"}
|
||||
### Configure the tunnel
|
||||
|
||||
Create a file `tunnelconfig.yml` to reference in your SWAG `compose.yaml`.
|
||||
|
||||
@@ -113,7 +102,7 @@ ingress:
|
||||
|
||||
Press :kbd{value="Ctrl+O"}, then :kbd{value="Enter"} to save, and :kbd{value="Ctrl+X"} to exit.
|
||||
|
||||
### Cloudflare Real IP Configuration
|
||||
### Configure Cloudflare Real IP
|
||||
|
||||
Now configure _Cloudflare Real IP_.
|
||||
|
||||
@@ -134,7 +123,7 @@ set_real_ip_from 127.0.0.1;
|
||||
|
||||
Save with :kbd{value="Ctrl+O"}, then :kbd{value="Enter"}, and exit with :kbd{value="Ctrl+X"}.
|
||||
|
||||
### Docker Compose
|
||||
### Deploy the SWAG stack
|
||||
|
||||
In Dockge, edit your SWAG stack with this:
|
||||
|
||||
@@ -227,26 +216,35 @@ Then confirm your tunnel appears under _Networks > Tunnels_ in [Cloudflare Zero
|
||||

|
||||
::
|
||||
|
||||
### Done !
|
||||
::
|
||||
|
||||
## Managing Multiple Tunnels for Multiple Servers
|
||||
By default, all subdomains of your domain are routed through the single tunnel. But if you have a second server, just change the tunnel name in that SWAG instance.
|
||||
By default, all subdomains of your domain are routed through the single tunnel. But if you have a second server, just change the tunnel name in that SWAG instance, and redirect subdomains to the correct tunnel in your DNS zone.
|
||||
|
||||
In your DNS zone, redirect subdomains to the correct tunnel.
|
||||
::steps{level="3"}
|
||||
### Change the tunnel name
|
||||
|
||||
Go to _Networks > Tunnels_ in [Cloudflare Zero Trust](https://one.dash.cloudflare.com/).
|
||||
In the second server's SWAG stack, set a different `TUNNEL_NAME` in the `.env` file, then redeploy.
|
||||
|
||||
Note the tunnel IDs:
|
||||
### Find the tunnel IDs
|
||||
|
||||
Go to _Networks > Tunnels_ in [Cloudflare Zero Trust](https://one.dash.cloudflare.com/) and note the tunnel IDs:
|
||||
|
||||

|
||||
|
||||
Then in the [Cloudflare DNS dashboard](https://dash.cloudflare.com/), click your domain name.
|
||||
### Add CNAME records
|
||||
|
||||
Click `Add Record` and add these two CNAME records (include `.cfargotunnel.com`):
|
||||
In the [Cloudflare DNS dashboard](https://dash.cloudflare.com/), click your domain name, then `Add Record` and add these two CNAME records (include `.cfargotunnel.com`):
|
||||
|
||||
| Type | Name | Target |
|
||||
|---------|--------------|----------------------------------------|
|
||||
| `CNAME` | `subdomain1` | `yourtunnelid1.cfargotunnel.com` |
|
||||
| `CNAME` | `subdomain2` | `yourtunnelid2.cfargotunnel.com` |
|
||||
|
||||
### Done !
|
||||
::
|
||||
|
||||
If you have many subdomains, point them to the above reference subdomains.
|
||||
|
||||
This way, if a tunnel ID changes, you only update one DNS record.
|
||||
|
||||
Reference in New Issue
Block a user