通过cloudflare实现内网穿透

通过cloudflare实现内网穿透

老阳
2024-06-14 / 0 评论 / 5 阅读 / 正在检测是否收录...

1.下载程序

wget https://git.histb.com/cloudflare/cloudflared/releases/download/2023.4.1/cloudflared-linux-arm -O /usr/bin/cloudflared

2.设置权限

chmod +x /usr/bin/cloudflared

3.登录

cloudflared login

4.授权

把 shh 页面的网址复制到浏览器 打开 然后登录,然后选域名,点击授权

5.创建隧道

[root@master ~]# cloudflared tunnel create 20230701 # 20230701 是通道名

Tunnel credentials written to /root/.cloudflared/818f00ee-a2af-4171-a7c6-ae57ebcb35e3.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 20230701 with id 818f00ee-a2af-4171-a7c6-ae57ebcb35e3

此步骤会返回通道 id(例:818f00ee-a2af-4171-a7c6-ae57ebcb35e3)

6.把上一步的隧道 ID 复制下来粘贴到下面的两个位置

mkdir -p /etc/cloudflared/ && cd /etc/cloudflared/

vim config.yml

tunnel: 818f00ee-a2af-4171-a7c6-ae57ebcb35e3

credentials-file: /root/.cloudflared/818f00ee-a2af-4171-a7c6-ae57ebcb35e3.json

ingress:
  - hostname: blog.stay-home.top

    service: http://127.0.0.1

  - service: http_status:404

7.给隧道分配域名

cloudflared tunnel route dns 20230701 blog.stay-home.top

8.安装服务

cloudflared service install

9.启动服务

systemctl start cloudflared

10.查看信息(可无)

systemctl status cloudflared

以上是本站的内穿操作流程。

0

评论 (0)

取消