Cloudflared内网穿透https访问

Cloudflared内网穿透https访问

admin
2024-01-08 / 0 评论 / 153 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2024年03月27日,已超过53天没有更新,若内容或图片失效,请留言反馈。
播放预览
剧集列表
cf内网穿透教程
备用播放地址

准备工作:

开始部署:

  • 下载程序到盒子里:
wget http://alist.ahrsf.com/d/code/HINAS/cloudflared/2023.10.0/cloudflared-linux-arm -O /usr/bin/cloudflared

Test

  • 在终端输入 # 非root用户请在前面加上 sudo
chmod -R 0777 /usr/bin/cloudflared
cloudflared login

此时终端会显示一个https:// 的网址,复制到浏览器打开,登录自己的cloudflare账号,选择要绑定的域名,并获取自动下载的授权文件

Test
Test

  • 创建一个隧道

例如

cloudflared tunnel create abc #abc 是你创建的隧道名称,记好,后面要用,这个名称可自定义

得到隧道的id

Test

  • 自制配置文件config.yml
vi config.yml

例如:

tunnel: 2cef3365-a4e7-4c8b-a151-f751857e521f
credentials-file: /root/.cloudflared/2cef3365-a4e7-4c8b-a151-f751857e521f.json

ingress:
  - hostname: abc.dearjoe.top
    service: http://127.0.0.1:5244
  - hostname: nas.dearjoe.top
    service: http://127.0.0.1
  - service: http_status:404

把这个配置文档放置到/etc/cloudflared/下面

在终端输入

mkdir -p /etc/cloudflared/
cp config.yml /etc/cloudflared/
cloudflared tunnel route dns nas nas.dearjoe.top
cloudflared tunnel route dns abc abc.dearjoe.top

  • 运行自启动安装
    /etc/cloudflared/ 修改配置重启即可

以下是常用命令

cloudflared service install    #运行自启动安装
cloudflared service uninstall  #卸载自启动安装
systemctl start cloudflared    #启动服务
systemctl restart cloudflared  #重启服务
systemctl stop cloudflared     #停止服务
systemctl status cloudflared   #查看运行状态  可随时ctrl + c 中止。

  • 开机自启
systemctl enable cloudflared
systemctl status cloudflared

Test

Test

本文引用 https://bbs.histb.com/d/240-cloudflared-https 稍加修改多隧道

1

评论 (0)

取消