frp使用配置

作者:king 发布日期:2025年5月13日 10:32 浏览量:63

https://gofrp.org/zh-cn/docs/setup/systemd/

一、部署

1.安装systemd

# 使用 yum 安装 systemd(CentOS/RHEL)
yum install systemd

# 使用 apt 安装 systemd(Debian/Ubuntu)
apt install systemd

2.编写

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

3.授权

chmod +x frps

4.启动服务

systemctl start frps

 

如有防火墙,开放端口命令:

sudo firewall-cmd --permanent --add-port=7070/tcp
sudo firewall-cmd --reload  # 重新加载防火墙配置使更改生效


#查看列表
sudo firewall-cmd --list-ports
# 或查看所有服务
sudo firewall-cmd --list-all

 

二、配置文件:

 

frps.toml

[common]
bind_port = 服务器ip
dashboard_port = 查看服务界面端口
dashboard_user = 登录用户
dashboard_pwd = 登录密码
max_pool_count = 20
log_level = debug
log_file = ./frps.log
log_max_days = 7
token = xxxxxx

 

frpc.ini

[common]
server_addr = 服务器ip
server_port = 服务器端口
token = xxxxxx
[server]
log_file = ./frpc.log
log_level = debug
log_max_days = 7

[网站1]
local_ip = 127.0.0.1
local_port = 80
remote_port = 80
无上一篇

搜索