Cloudflare setup

来自牛奶河Wiki
阿奔讨论 | 贡献2024年3月14日 (四) 10:55的版本
跳到导航 跳到搜索

内网穿透

Zero Trust -> Access -> Tunnels

Create a tunnel

  • Name your tunnel TEST
  • Choose your environment
  • Install and run a connector
# 内网主机
https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-x86_64.rpm
yum localinstall cloudflared.rpm
cloudflared service install eyJhIjoiODNiYzVmMTQ2YzhmZGIyNmQ4ZDlkNTJlM2E1YjFmNWEiLCJ0IjoiM2IxMjAwMWEtYjk1My00MDRjLThkYjMtZDQ5ZTEwMDVhYmU1IiwicyI6Ik1EUm1OMlEyTW1ZdFlUVXhaUzAwTm1JMUxUa3hZMlV0TmpJME1tVmxaV0ptWkdZeiJ9

Public hostnames

HTTP
  • Add public hostname for http://localhost:8088
p88.server.com --> http://127.0.0.1:8088
SSH
  • Add public hostname for localhost:22
ssh.server.com --> ssh://127.0.0.1:22
  • Client
# /usr/local/bin/cloudflared
.ssh/config
Host ssh.server.com
ProxyCommand /usr/local/bin/cloudflared access ssh --hostname %h

ssh ssh.server.com

DNS

  1. 在域名提供商 nameserver 中指向 cloudflare(carrera.ns.cloudflare.com, matteo.ns.cloudflare.com)
  2. 在 cloudflare 建立 DNS 解析,如:A 类解析 mwbbs.eu.org 132.145.61.120,选择:不通过 proxy 处理(否则某些地区无法正确解析)