koto's Site 🤪 About me Search Post Tags Archives Friendly sites Switch theme Settings

在 Archlinux 上设定 Cloudflare Tunnel

如何在 Archlinux 上设定 Cloudflare Tunnel

2023-10-28 20:36+0800 About 31s

 Tagged with:

1. 安装

执行 sudo pacman -Sy cloudflared 即可。

2. 配置

先执行 cloudflared tunnel login 登入 Cloudflared.

接着使用 cloudflared tunnel create web-test 创建一个名为 bot-webhook-test 的 Tunnel.

~/.cloudflared/config.yaml 中写入你自己的配置文件,下面只做示范:

tunnel: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
credentials-file: /home/koto/.cloudflared/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.json
ingress:
  # web-test
  - hostname: test.ooze.gq
    service: http://localhost:3000
  - service: http_status:404

运行 cloudflared tunnel route dns web-test test.ooze.gq 更新 tunnel dns.

最后使用 cloudflared tunnel run web-test 运行 tunnel 即可。