【新版本.toml】内网穿透工具frp,搭建保姆级教程

新版本更新了不少配置,感兴趣的可以去官方文档研究研究

下载安装包,请点击历史文章 本文不再啰嗦

历史版本参考

历史文章

安装 systemd

如果您的 Linux 服务器上尚未安装 systemd,可以使用包管理器如 yum(适用于 CentOS/RHEL)或 apt(适用于 Debian/Ubuntu)来安装它:

使用 yum 安装 systemd(CentOS/RHEL)

yum install systemd

使用 apt 安装 systemd(Debian/Ubuntu)

apt install systemd
创建 frps.service 文件

使用文本编辑器 (如 vim) 在 /etc/systemd/system 目录下创建一个 frps.service 文件,用于配置 frps 服务。

$ sudo vim /etc/systemd/system/frps.service
写入内容

[Unit]
# 服务名称,可自定义
Description = frp server
After = network.target syslog.target
Wants = network.target

[Service]
Type = simple
# 启动frps的命令,需修改为您的frps的安装路径
ExecStart = /path/to/frps -c /path/to/frps.toml

[Install]
WantedBy = multi-user.target

启动frps的命令,需修改为您的frps的安装路径

ExecStart = /path/to/frps -c /path/to/frps.toml

[Install]
WantedBy = multi-user.target
使用 systemd 命令管理 frps 服务

启动frp

sudo systemctl start frps

停止frp

sudo systemctl stop frps

重启frp

sudo systemctl restart frps

查看frp状态

sudo systemctl status frps
设置 frps 开机自启动

sudo systemctl enable frps

frps.toml参考配置

#绑定端口
bindPort = 7000
# 如果指定了“oidc”,将使用 OIDC 设置颁发 OIDC(开放 ID 连接)令牌。默认情况下,此值为“令牌”。auth.method = “token”
auth.method = "token"
# 身份验证令牌 auth.token = “12345678”
auth.token = "12345678"
# 配置 Web 服务器以启用 frps 的仪表板。
webServer.addr = "0.0.0.0"
webServer.port = 7500
webServer.user = "admin"
webServer.password = "xxxxx"

##特别说明---如果客户端要配置type为http类型代理时,需要配置以下虚拟机端口
# 虚拟主机端口 
vhostHTTPPort = 8080 
## SSL 虚拟主机端口 
vhostHTTPSPort = 1443


# 日志配置
log.to = "/path/to/frps.log"
log.level = "info"
log.maxDays = 3
# disable log colors when log.to is console, default is false
log.disablePrintColor = false

客户端搭建步骤

下载安装frps对应客户端版本,具体可参考下老版本

历史文章

更改frpc.toml文件

# 修改为frps部署服务器ip
serverAddr = "x.x.x.x"
#frps部署服务器端口
serverPort = 7000

#鉴权方式,可选值为 token 或 oidc,默认为 token。
auth.method = "token"
# 身份验证令牌
auth.token = "12345678"
# 设置管理员地址,通过 http API 控制 frpc 的操作,例如重新加载
webServer.addr = "0.0.0.0"
webServer.port = 7400
webServer.user = "admin"
webServer.password = "123456"
webServer.pprofEnable = false

# 日志配置
log.to = "/path/to/frpc.log"
log.level = "info"
log.maxDays = 3
# disable log colors when log.to is console, default is false
log.disablePrintColor = false

 

[[proxies]]
name = "tcp01"
type = "tcp"
localIP = "127.0.0.1"
localPort = 82
#如果remotePort为0,frps将为您分配一个随机端口
remotePort = 9000

[[proxies]]
name = "tcp02"
type = "tcp"
localPort = 83
remotePort = 9001

[[proxies]]
name = "http_web"
type = "http"
localPort = 83
remotePort = 9001
#配置服务器域名或ip
customDomains = ["xxx.xxx.xxx.xxx"]


  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值