侧边栏壁纸
  • 累计撰写 99 篇文章
  • 累计创建 54 个标签
  • 累计收到 1 条评论

目 录CONTENT

文章目录

cloudflare tunnel 反代安装流程

FlyingEagle
2022-05-06 / 0 评论 / 0 点赞 / 98 阅读 / 1,283 字

下载安装文件和解压脚本

wget -q https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && dpkg -i cloudflared-linux-amd64.deb

如不能下载,直接下载安装文件

https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb

下载后运行安装文件

./cloudflared-linux-amd64.deb

登陆

cloudflared tunnel login

登陆后用给到授权地址如下图在CF选择需要反代的域名,脚本会自动下载密钥文件,如果最后一行末尾显示net/http: TLS handshake timeout,需要自行用给出的地址下载pem密钥文件到/root/.cloudflared/cert.pem

photo_2022-05-07_10-52-01

得到Tunnel credentials written to /root/.cloudflared/
tunnel: -9df6-48ea--f457b2a****
credentials-file: /root/.cloudflared/*****.json

进入/root/.cloudflared/目录 创建项目

cloudflared tunnel create <项目名称>

关联项目名称和CF的域名

cloudflared tunnel route dns <项目名称> ***.qtmcat.com

/root/.cloudflared/目录下创建config.yml 加入以下

tunnel: *****-9df6-48ea-*****-f457b2a****
credentials-file: /root/.cloudflared/*****.json

ingress:
  - hostname: ***.qtmcat.com
    service: http://192.168.2.38:端口
  - hostname: qtmcat.com
    service: http://192.168.2.38:8090
  - hostname: **.qtmcat.com
    service: http://192.168.2.206:端口
  - hostname: **.qtmcat.com
    service: http://192.168.2.210:端口
  - hostname: **.qtmcat.com
    service: http://192.168.2.210:80
  - service: http_status:404

微信图片_20220506111439

运行项目

cloundflared tunnel run <项目名称>

开机后台运行

cloudflared service install

添加新网址后需要重新安装
先卸载

cloudflared service uninstall

之后重新安装后台运行,之前需要删除原来的配置文件

rm /etc/cloudflared/config.yml
0

评论区