FRP 内网穿透服务部署指南

301 字
2 分钟
FRP 内网穿透服务部署指南
Note

服务端需要一台有公网 IP 的服务器,尚未初始化服务器?参见:Linux 服务器初始化配置

FRP 通过有公网 IP 的服务器将内网主机端口暴露到互联网。分为 服务端(frps)客户端(frpc),服务端需部署在有公网 IP 的机器上,客户端部署在内网主机上。

GitHub:fatedier/frp

下载#

前往 Releases 页面下载对应系统的压缩包,Linux 选择 frp_xxxx_linux_amd64.tar.gz

Terminal window
# 赋予执行权限
chmod +x frps frpc

配置文件#

服务端(frps.toml)#

Warning

auth.tokenwebServer.password 必须修改为强随机值,弱凭据会导致隧道被未授权访问。

bindAddr = "0.0.0.0"
bindPort = 65001
transport.tls.force = true
auth.method = "token"
auth.token = "your-token"
# Dashboard
webServer.addr = "0.0.0.0"
webServer.port = 65002
webServer.user = "admin"
webServer.password = "your-password"

客户端(frpc.toml)#

serverAddr = "your-public-ip"
serverPort = 65001
transport.tls.enable = true
auth.token = "your-token"
# 代理规则示例
[[proxies]]
name = "web80"
type = "tcp"
localIP = "127.0.0.1"
localPort = 80
remotePort = 80
[[proxies]]
name = "web443"
type = "tcp"
localIP = "127.0.0.1"
localPort = 443
remotePort = 443

Systemd 服务管理#

Terminal window
# frps 服务文件
cat > /etc/systemd/system/frps.service << 'EOF'
[Unit]
Description=frps
After=network.target
[Service]
TimeoutStartSec=30
ExecStart=/opt/frps/frps -c /opt/frps/frps.toml
Restart=always
[Install]
WantedBy=multi-user.target
EOF
# frpc 服务文件
cat > /etc/systemd/system/frpc.service << 'EOF'
[Unit]
Description=frpc
After=network.target
[Service]
TimeoutStartSec=30
ExecStart=/opt/frpc/frpc -c /opt/frpc/frpc.toml
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now frps
systemctl status frps

支持与分享

如果这篇文章对你有帮助,欢迎分享给更多人或赞助支持!

赞助
FRP 内网穿透服务部署指南
https://blog.olinl.com/posts/frp-deploy/
作者
顾拾柒
发布于
2026-02-07
许可协议
CC BY-NC-SA 4.0

评论区

Profile Image of the Author
顾拾柒
The world is big, you have to go and see.
公告
欢迎来到我的博客!
分类
标签
站点统计
文章
81
分类
7
标签
158
总字数
83,114
运行时长
0
最后活动
0 天前
站点信息
构建平台
Vercel
博客版本
Firefly v6.12.1
文章许可
CC BY-NC-SA 4.0

文章目录