接上条: 尝试Cloudflare Tunnel使本地的IPNS公网访问 – 封闭脑袋
为一条隧道绑定多个域名
cloudflared tunnel route dns [名字或者 UUID] [想要绑定到的域名或其二级域名]
# 例如:
cloudflared tunnel route dns my-tunnel doh3.us.kg
cloudflared tunnel route dns my-tunnel p.doh3.us.kg
# 目标域名必须没有设定相关DNS解析记录
执行命令会自动设定对应的CNAME解析记录
创建 ~/.cloudflared/config.yml
,在ingress中写入多个(子)域名和对应本机端口
这是我的配置文件
tunnel: my-tunnel
credentials-file: /Users/joomaen/.cloudflared/8ccec36b-9bf8-4c6c-a397-b1f7b3dede65.json
ingress:
- hostname: doh3.us.kg
service: http://localhost:18181
- hostname: p.doh3.us.kg
service: http://localhost:8086
- service: http_status:404
使用配置文件启动Cloudflare Tunnel
cloudflared tunnel --config /path/to/your/custom-config.yml run
# 在macOS上
cloudflared tunnel --config ~/.cloudflared/config.yml run
发表回复