Popular blog tags

How to Install Cloudflare Tunnel Client On Windows 10 Step by Step(command line method)?


GUI Method

CLI Method-->command line



Cloudflare Account (free)
Domain added to Cloudflare (using CF nameservers, etc)
Linux server with a web server already configured on it
No ports need to be port forwarded or allowed through your firewall

Quick tutorial

CLI Method-This can be done through the following steps:

Create a Cloudflare Account 

Add Site-Add a website Domain to your Cloudflare account.
Change your domain nameservers to Cloudflare

Download the latest version of cloudflared(rename your download to cloudflared.exe)
Install Cloudflared

check cloudflared version

Authenticate cloudflared-Connect Your Cloudflare Account,cloudflared tunnel login,Generate an account certificate, the cert.pem file, in the default cloudflared directory.

Create a Tunnel
Route traffic to your tunnel

Click the Add an Xiaomi Miot Auto Integration 


cloudflared version
cloudflared update

cloudflared tunnel login   -->Generate an account certificate, the cert.pem file

cloudflared tunnel create xiaomi --> Create a Tunnel,建立隧道,生成 .json 凭据文件,用于当前隧道的认证
cloudflared tunnel route dns xiaomi xiaomi.msly.cn  -->Route traffic to your tunnel, 把域名然后把域名 CNAME到 7357f5c5-c274-4464-a61a-63ee07af8cca.cfargotunnel.com

cloudflared tunnel run xiaomi
cloudflared tunnel --config ./config.yml run
cloudflared  --config ./config.yml tunnel run
C:\Cloudflared\bin\cloudflared.exe --config=C:\Users\%USERNAME%\.cloudflared\config.yml tunnel run
cloudflared tunnel --url localhost:4999 --no-chunked-encoding run xiaomi
cloudflared tunnel --hostname xiaomi.msly.cn --url http://localhost:4999 --no-tls-verify

cloudflared tunnel list
cloudflared tunnel info xiaomi



Step 1:Install cloudflared on windows




主机名:           SRKSERVER
OS 名称:          Microsoft Windows 10 专业版
OS 版本:          10.0.19044 暂缺 Build 19044
OS 制造商:        Microsoft Corporation
OS 配置:          独立工作站

通过GitHub下载适用于 Windows 的安装包 这里包含了两种版本 386=i1386 也就是 32 位的 Windows 系统 amd64 也就是 64 位的 Windows 系统 我们下载.exe 可执行文件




rename your download to cloudflared.exe

cloudflared-windows-amd64 .exe
ren cloudflared-windows-amd64 .exe cloudflared.exe

Step 2:check Argo Tunnel run ok

下载好后把文件改名为 cloudflared.exe 然后把他复制到F:\CloudflareArgoTunnel

F:\CloudflareArgoTunnel>cloudflared.exe --version



cloudflared version 2022.5.1 (built 2022-05-11-1402 UTC)

update to latest version

F:\CloudflareArgoTunnel>cloudflared update
2022-06-23T22:30:16Z INF cloudflared has been updated version=2022.6.3
cloudflared has been updated to version 2022.6.3

F:\CloudflareArgoTunnel>cloudflared version
cloudflared version 2022.6.3 (built 2022-06-20-1350 UTC)

Step 3: Authenticate cloudflared-Connect Your Cloudflare Account,cloudflared tunnel login

cloudflared tunnel login # 登录,生成 cert.pem


F:\CloudflareArgoTunnel>cloudflared tunnel login
A browser window should have opened at the following URL:


If the browser failed to open, please visit the URL above directly in your browser.
You have successfully logged in.
If you wish to copy your credentials to a server, they have been saved to:



Upload your Tunnel certificate
Your browser has downloaded the certificate required to configure the cloudflared client on your machine.
Copy the certificate to your home directory or manually configure Cloudflare Tunnel with the path to the certificate using the --origincert option.


接着你需要打开Cloudflare Argo Tunnel 的授权页面 在里面点击你要授权 Argo Tunnel 的域名 接着会弹出来一个弹窗

提示你点击授权,照着文字点就行 然后你的浏览器会自动下载一个叫 cert.pem 的文件 复制它 然后进入到你的用户文件夹,创建一个.cloudflared 文件夹 将文件粘贴进去 这样就完成了对 Argo Tunnel 的配置.

Cloudflared has installed a certificate allowing your origin to create a Tunnel on this zone.

You may now close this window and start your Cloudflare Tunnel!


Create a Tunnel-创建 Argo 隧道-建立隧道,生成 .json 凭据文件,用于当前隧道的认证


./cloudflared.exe tunnel create <你想要的隧道名称>
cloudflared tunnel create <TUNNEL-NAME>

cloudflared.exe tunnel create xiaomi


F:\CloudflareArgoTunnel>cloudflared.exe tunnel create xiaomi
Tunnel credentials written to C:\Users\Administrator2\.cloudflared\1b65b260-4420-40ef-bc3e-6960447f8851.json. cloudflared chose this file based on where your origin certificate was found. Keep this file secret. To revoke these credentials, delete the tunnel.

Created tunnel xiaomi with id 1b65b260-4420-40ef-bc3e-6960447f8851




F:\CloudflareArgoTunnel>cloudflared tunnel --hostname xiaomi.msly.cn --url http://localhost:4999 --no-tls-verify


you are using Cloudflare Tunnel in a (legacy) way that is no longer supported.Migrate to Named Tunnels to continue exposing your private origin through Cloudflare's Network.You can follow this guide: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/do-more-with-tunnels/migrate-legacy-tunnels as an example.Alternatively, you can go to https://dash.teams.cloudflare.com/ -> Access -> Tunnels -> Create and rely on the User Interface instead.


Route traffic to your tunnel-Adding a DNS record for the tunnel-连接 Argo 隧道

./cloudflared tunnel --config path/config.yaml run <刚刚的隧道名> --url <本地URL(可以带端口)>

# 把域名然后把域名 CNAME到 7357f5c5-c274-4464-a61a-63ee07af8cca.cfargotunnel.com
cloudflared tunnel route dns xiaomi xiaomi.msly.cn  


cloudflared tunnel route dns xiaomi xiaomi.msly.cn
2022-06-23T16:53:04Z INF Added CNAME xiaomi.msly.cn which will route to this tunnel tunnelID=1b6520-40ef-bc3e-6960447f8851

The command will create a CNAME record that points to the tunnel subdomain, but will not proxy traffic if the tunnel is not currently running.

you will see as follow from the Cloudflare dashboard :



 Configure a Tunnel ->Configure a Tunnel instructions to create a config file with ingress rules.
The ingress rules describe how to dispatch requests to your origins based on hostname and path. 

#在.json 凭据文件的同一目录建立 config.yml 文件

#credentials-file: "C:/Users/Administrator/.cloudflared/7357f5c5-c274-4464-a61a-63ee07af8cca.json"
tunnel: new-website
hostname: launchpad.domain.com
url: https://localhost:443
logfile: "C:/Users/Administrator/.cloudflared/cloudflared.log"
no-tls-verify: true


# 然后把域名然后把域名 CNAME到 7357f5c5-c274-4464-a61a-63ee07af8cca.cfargotunnel.com

cloudflared tunnel route dns <UUID or NAME> www.app.com

cloudflared tunnel run

sc start cloudflared tunnel run

cloudflared tunnel list
cloudflared tunnel delete <NAME>
cloudflared tunnel delete -f <NAME>

Useful links