需要一台服务器
frp下载链接:https://github.com/fatedier/frp/releases
frp文档:https://gofrp.org/zh-cn/docs/reference/server-configures/#authserverconfig
下载之后有几个文件:frps、frps.toml、frpc、frpc.toml
分别是服务端程序、服务端配置文件、客户端程序、客户端配置文件
注意!vhostHTTPPort和客户端中的localPort没有关联性
frps
必须写vhostHTTPPort
不然客户端不支持http方式。(这个端口可以随意)
在服务器安全组中开放7000端口(如果是宝塔记得在宝塔中的安全开放并且在服务器提供商都开放端口)
在服务器中用nginx反向代理frpc.toml中的customDomains
域名到frps.toml中的vhostHTTPPort
端口
bindPort = 7000
auth.token = "abcd2025"
vhostHTTPPort = 8080
启动服务端
./frps -c frps.toml
frpc
客户端配置
localIP
本机IP,也可以写127.0.0.1
localPort
本机业务所在端口
customDomains
访问的域名
serverAddr = "服务器IP"
serverPort = 7000
auth.token = "abcd2025"
[[proxies]]
name = "qts"
type = "http"
localIP = "192.168.1.66"
localPort = 8080
customDomains = ["xxx.example.cn"]
启动客户端
./frpc -c frpc.toml