ele

ele

ele

cloud studio 之 frp内网穿透

cloud studio 之 frp 内网穿透#

看到群友说 cloud studio 的高性能 gpu 基础型机器部署 frp 总是失败,不知道错在哪里,故作者也尝试部署一次,看看能不能部署成功。
所需准备

  1. 一台有公网 ip 的 vps
  2. 一个已经托管在 cf 的域名,并且指向了这个公网 ip

必须关闭小云朵

  1. 均能下载或者说获取到 frp 的安装包

好的,我们现在开始

a. 首先在自己的公网 vps 上执行下载命令

curl https://github.com/fatedier/frp/releases/download/v0.61.1/frp_0.61.1_linux_amd64.tar.gz

b. 解压缩

tar -zxvf frp_0.61.1_linux_amd64.tar.gz

c. 重命名

mv frp_0.61.1_linux_amd64 frp

d. 进入到 frp 目录

cd frp

e. 修改配置文件
带 s 的是服务端即,是有公网 ip 的 vps 运行配置文件,以指定 HTTP 请求的监听端口为 8080

vim frps.toml

内容如下:

bindPort = 7000
vhostHTTPPort = 8080

如果需要配置 HTTPS 代理,还需要设置 vhostHTTPSPort。
更多参数可参考这里 https://github.com/fatedier/frp?tab=readme-ov-file#expose-a-simple-http-file-server

我这里是 5678
sxSull
f. 运行 服务端

./frps -c frps.toml

0VWFSZ

打开我们的 cloud studio,选择 gpu 基础型,重复上面的步骤 a-d
此时,我们需要修改 frpc.toml 配置文件

带 c 的是客户端,即我们需要穿透的内网服务器,没有公网 ip 的

修改 frpc.toml 文件

vim frpc.toml

内容我这里是:

serverAddr = "10x.xx.xx.xx"
serverPort = 7890

[[proxies]]
name = "web"
type = "http"
localPort = 81
customDomains = ["cf.xx.xx.xx"]

serverAddr 为你公网 vps 的 ip 地址,localPort,为本地开启服务的端口,比如我用 python 简单的开启了一个 81 的 http 服务,customDomains 为你托管在 cf 的域名,并且指向了公网 vps 的 ip,注意一定要关闭小云朵,要不然会失败

Ea5F3k

修改完之后运行

./frpc -c frpc.toml

T7g5B0

为了测试,我在 cloud studio 上用 python 简单开启了一个 http 服务
命令是:python -m http.server 81
9a8kCd
通过 cs 提供的 proxy 服务我们可以打开 81 端口
https://xxxxxx.ap-shanghai.cloudstudio.work/proxy/81
iELYIZ
访问正常,接着,我们通过 frp 配置的域名来进行访问测试
http://xxx.xxx.xxx:5678
wkMdA2

在附上 cloudflare 的截图
D567CFCD-B0AF-4299-9A87-4FD2B280EC6F

至此,本教程结束。有关具体的参数,相见frp 项目文档

加载中...
此文章数据所有权由区块链加密技术和智能合约保障仅归创作者所有。