Skip to content

搭建

官网

https://github.com/fatedier/frp

下载

https://github.com/fatedier/frp/releases

解压

tar -zxvf frp_0.61.2_linux_amd64.tar.gz

移动到etc下,并修改 frp_0.61.2_linux_amd64 为 frp

服务端配置

bindPort = 7000
# 新型多路复用传输
quicBindPort = 7000


# 仪表盘配置
webServer.addr = "0.0.0.0"
webServer.port = 7500
webServer.user = "liuchenyun"
webServer.password = ""

# 连接池数量
transport.maxPoolCount = 50
# 启用并指定连接池数量:
#transport.poolCount = 10

# 令牌认证
auth.method = "token"
auth.token = "c5d90fcaecc444c29aa6dc4e728bef5f1"

# 加密和压缩
#transport.useEncryption = true
#transport.useCompression = true
#transport.protocol = "quic"

手动启动

# 检查配置文件语法
/etc/frp/frps -c /etc/frp/frps.toml --check

# 若语法正确,手动启动查看详细日志
/etc/frp/frps -c /etc/frp/frps.toml

/etc/frp/frpc -c /etc/frp/frpc.toml

开机自启

cat <<EOF | tee /etc/systemd/system/frps.service
[Unit]
Description=FRP Server
After=network-online.target
Wants=network-online.target
[Service]
User=root
WorkingDirectory=/etc/frp
ExecStart=/etc/frp/frps -c /etc/frp/frps.toml
Environment=FRP_LOG_LEVEL=info
Restart=always
RestartSec=5s
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl start frps
sudo systemctl stop frps
sudo systemctl status frps
sudo systemctl enable frps