Skip to content
On this page

下载

bash
curl -L 'https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64' -o /usr/local/bin/cloudflared
```bash

1.  登录认证

```bash
cloudflared tunnel login
```bash

2.  创建域名,得到隧道ID

```bash
cloudflared tunnel route dns ssh awssgssh.543083.xyz
```bash

3.  修改配置文件,添加 SSH 代理

```bash
cat > /root/.cloudflared/config.yml << EOF
tunnel: e7425241-3827-4e3a-830e-dde066ae6915
credentials-file: /root/.cloudflared/e7425241-3827-4e3a-830e-dde066ae6915.json
protocol: h2mux
ingress:
  # 第五个,反代 SSH 服务
  - hostname: awssgssh.543083.xyz
    service: ssh://localhost:1522
  # 最后记得添加一个默认 404
  - service: http_status:404
EOF
```bash

4.  验证

```bash
cloudflared tunnel ingress validate
cloudflared tunnel ingress rule https://awssgssh.543083.xyz
```bash

5.  启动测试

```bash
cloudflared tunnel --config ~/.cloudflared/config.yml run e7425241-3827-4e3a-830e-dde066ae6915
```bash

6.  安装系统服务

```bash
cloudflared --config /root/.cloudflared/config.yml service install
```bash

7.  配置页面 application 参考:使用 Cloudflare Tunnels 通过 Web SSH 访问服务器 参考:https://blog.hellowood.dev/posts/%E4%BD%BF%E7%94%A8cloudflare-tunnels%E9%80%9A%E8%BF%87web-ssh%E8%AE%BF%E9%97%AE%E6%9C%8D%E5%8A%A1%E5%99%A8/

> Photo by [Pawel Czerwinski](https://unsplash.com/@pawel_czerwinski) on [Unsplash](https://unsplash.com/)
curl -L 'https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64' -o /usr/local/bin/cloudflared
```bash

1.  登录认证

```bash
cloudflared tunnel login
```bash

2.  创建域名,得到隧道ID

```bash
cloudflared tunnel route dns ssh awssgssh.543083.xyz
```bash

3.  修改配置文件,添加 SSH 代理

```bash
cat > /root/.cloudflared/config.yml << EOF
tunnel: e7425241-3827-4e3a-830e-dde066ae6915
credentials-file: /root/.cloudflared/e7425241-3827-4e3a-830e-dde066ae6915.json
protocol: h2mux
ingress:
  # 第五个,反代 SSH 服务
  - hostname: awssgssh.543083.xyz
    service: ssh://localhost:1522
  # 最后记得添加一个默认 404
  - service: http_status:404
EOF
```bash

4.  验证

```bash
cloudflared tunnel ingress validate
cloudflared tunnel ingress rule https://awssgssh.543083.xyz
```bash

5.  启动测试

```bash
cloudflared tunnel --config ~/.cloudflared/config.yml run e7425241-3827-4e3a-830e-dde066ae6915
```bash

6.  安装系统服务

```bash
cloudflared --config /root/.cloudflared/config.yml service install
```bash

7.  配置页面 application 参考:使用 Cloudflare Tunnels 通过 Web SSH 访问服务器 参考:https://blog.hellowood.dev/posts/%E4%BD%BF%E7%94%A8cloudflare-tunnels%E9%80%9A%E8%BF%87web-ssh%E8%AE%BF%E9%97%AE%E6%9C%8D%E5%8A%A1%E5%99%A8/

> Photo by [Pawel Czerwinski](https://unsplash.com/@pawel_czerwinski) on [Unsplash](https://unsplash.com/)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53