FRPS service 无法启动

115 天前
 snipes

在 ubuntu vps 上安装了 FRPS ,并且按照以下方法添加了 FRPS service 。 https://gist.github.com/h1code2/3a749d966ed5ef36e4836d24c3f7d3d8

使用 frps 命令是可以启动程序,但是使用 frps service 无法启动,运行 sudo systemctl start frps ,始终是 deactivated 。

~$ sudo systemctl status frps
○ frps.service - FRP Server Service
     Loaded: loaded (/etc/systemd/system/frps.service; enabled; vendor preset: enabled)
     Active: inactive (dead) since Wed 2025-04-09 05:21:21 UTC; 4s ago
    Process: 11559 ExecStart=/usr/bin/frps -c /usr/local/frps/frps.toml (code=exited, status=0/SUCCESS)
   Main PID: 11559 (code=exited, status=0/SUCCESS)
        CPU: 114ms

Apr 09 05:21:21 HK frps[11566]: # quic protocol options
Apr 09 05:21:21 HK frps[11566]: # transport.quic.keepalivePeriod = 10
Apr 09 05:21:21 HK frps[11566]: # transport.quic.maxIdleTimeout = 30
Apr 09 05:21:21 HK frps[11566]: # transport.quic.maxIncomingStreams = 100000
Apr 09 05:21:21 HK frps[11566]:
Apr 09 05:21:21 HK frps[11566]: # Heartbeat configure, it's not recommended to modify the default value
Apr 09 05:21:21 HK frps[11566]: [149B blob data]
Apr 09 05:21:21 HK frps[11566]: Vim: Finished.
Apr 09 05:21:21 HK frps[11566]: [7B blob data]
Apr 09 05:21:21 HK systemd[1]: frps.service: Deactivated successfully.

请教一下,有没有人知道如何解决?谢谢。

1984 次点击
所在节点    Linux
21 条回复
Seahurt
115 天前
配置文件有可能有问题吧。进程的 exit code 是 0 说明程序正常退出了。
mk3s
115 天前
开 ssh 我上去看一下
sn0wdr1am
115 天前
通常都是配置问题,你的配置文件是/usr/local/frps/frps.toml ?
yulgang
115 天前
开 ssh 我上去看一下
koala9527
115 天前
配置一下日志,查看一下日志文件
Tiande
115 天前
docker 跑比较方便
NessajCN
115 天前
把下面两个命令的输出内容贴上来

ls /usr/local/frps
cat /usr/local/frps/frps.toml
chinni
115 天前
直接 shell 下执行 放前台 就知道原因了。如果前台可以,再考虑服务后的 CWD 和 权限呗。
aru
115 天前
直接运行 /usr/bin/frps -c /usr/local/frps/frps.toml
就会知道原因了
一般来说,要么文件路径不对,要么配置文件有问题
skiy
115 天前
该 gist 漏了一点。没有执行 systemctl daemon-reload
aloxaf
115 天前
这日志看着太奇怪了,不仅有 「 blob data 」 还有「 Vim: Finished 」,这是在里面启动了 vim ?究竟怎么写配置才能做到这种效果?

建议把服务、配置都发出来看一下。
snipes
115 天前
@aru
运行完这个/usr/bin/frps -c /usr/local/frps/frps.toml ,系统直接用 vi 打开了 frps.toml 配置文件。
snipes
115 天前
@NessajCN

第一个命令
ls /usr/local/frps
enable enable.20250409-000000 frps frps.toml

第二个命令
cat /usr/local/frps/frps.toml

bindAddr = "0.0.0.0"
bindPort = 5443

# udp port used for kcp protocol, it can be same with 'bindPort'.
# if not set, kcp is disabled in frps.
kcpBindPort = 5443

# udp port used for quic protocol.
# if not set, quic is disabled in frps.
quicBindPort = 8443

# Specify which address proxy will listen for, default value is same with bindAddr
# proxyBindAddr = "127.0.0.1"

# quic protocol options
# transport.quic.keepalivePeriod = 10
# transport.quic.maxIdleTimeout = 30
# transport.quic.maxIncomingStreams = 100000

# Heartbeat configure, it's not recommended to modify the default value
# The default value of heartbeatTimeout is 90. Set negative value to disable it.
transport.heartbeatTimeout = 90

# Pool count in each proxy will keep no more than maxPoolCount.
transport.maxPoolCount = 5

# If tcp stream multiplexing is used, default is true
transport.tcpMux = true

# Specify keep alive interval for tcp mux.
# only valid if tcpMux is true.
# transport.tcpMuxKeepaliveInterval = 30

# tcpKeepalive specifies the interval between keep-alive probes for an active network connection between frpc and frps.
# If negative, keep-alive probes are disabled.
# transport.tcpKeepalive = 7200

# transport.tls.force specifies whether to only accept TLS-encrypted connections. By default, the value is false.
# transport.tls.force = false

# transport.tls.certFile = "server.crt"
# transport.tls.keyFile = "server.key"
# transport.tls.trustedCaFile = "ca.crt"

# If you want to support virtual host, you must set the http port for listening (optional)
# Note: http port and https port can be same with bindPort
vhostHTTPPort = 8080
vhostHTTPSPort = 8443

# Response header timeout(seconds) for vhost http server, default is 60s
# vhostHTTPTimeout = 60

# tcpmuxHTTPConnectPort specifies the port that the server listens for TCP
# HTTP CONNECT requests. If the value is 0, the server will not multiplex TCP
# requests on one single port. If it's not - it will listen on this value for
# HTTP CONNECT requests. By default, this value is 0.
# tcpmuxHTTPConnectPort = 1337

# If tcpmuxPassthrough is true, frps won't do any update on traffic.
# tcpmuxPassthrough = false

# Configure the web server to enable the dashboard for frps.
# dashboard is available only if webServerport is set.
webServer.addr = "0.0.0.0"
webServer.port = 6443
webServer.user = "admin"
webServer.password = "lokithor4123"
# webServer.tls.certFile = "server.crt"
# webServer.tls.keyFile = "server.key"
# dashboard assets directory(only for debug mode)
# webServer.assetsDir = "./static"

# Enable golang pprof handlers in dashboard listener.
# Dashboard port must be set first
# webServer.pprofEnable = false

# enablePrometheus will export prometheus metrics on webServer in /metrics api.
# enablePrometheus = true

# console or real logFile path like ./frps.log
log.to = "enable"
# trace, debug, info, warn, error
log.level = "info"
log.maxDays = 3
# disable log colors when log.to is console, default is false
# log.disablePrintColor = false

# DetailedErrorsToClient defines whether to send the specific error (with debug info) to frpc. By default, this value is true.
# detailedErrorsToClient = true

# auth.method specifies what authentication method to use authenticate frpc with frps.
# If "token" is specified - token will be read into login message.
# If "oidc" is specified - OIDC (Open ID Connect) token will be issued using OIDC settings. By default, this value is "token".
auth.method = "token"

# auth.additionalScopes specifies additional scopes to include authentication information.
# Optional values are HeartBeats, NewWorkConns.
# auth.additionalScopes = ["HeartBeats", "NewWorkConns"]

# auth token
auth.token = "6vMltzpz9E9ulEgi"

# userConnTimeout specifies the maximum time to wait for a work connection.
# userConnTimeout = 10

# Max ports can be used for each client, default value is 0 means no limit
# maxPortsPerClient = 0

# If subDomainHost is not empty, you can set subdomain when type is http or https in frpc's configure file
# When subdomain is test, the host used by routing is test.frps.com
subDomainHost = "20.198.220.105"

# custom 404 page for HTTP requests
# custom404Page = "/path/to/404.html"

# specify udp packet size, unit is byte. If not set, the default value is 1500.
# This parameter should be same between client and server.
# It affects the udp and sudp proxy.
# udpPacketSize = 1500

# Retention time for NAT hole punching strategy data.
# natholeAnalysisDataReserveHours = 168

# ssh tunnel gateway
# If you want to enable this feature, the bindPort parameter is required, while others are optional.
# By default, this feature is disabled. It will be enabled if bindPort is greater than 0.
# sshTunnelGateway.bindPort = 2200
# sshTunnelGateway.privateKeyFile = "/home/frp-user/.ssh/id_rsa"
# sshTunnelGateway.autoGenPrivateKeyPath = ""
# sshTunnelGateway.authorizedKeysFile = "/home/frp-user/.ssh/authorized_keys"
snipes
115 天前
@NessajCN
另外,我运行 file /usr/bin/frps
得到这个
/usr/bin/frps: symbolic link to /etc/init.d/frps
NessajCN
115 天前
@snipes 你这 frps 程序咋装的
/etc/init.d/frps 是正常的可执行文件吗?
建议直接把 frps 执行文件放到 /usr/local/bin/ 里
然后 /usr/local/bin/frps -c /usr/local/frps/frps.toml
hxy100
115 天前
重装 frps ,根据你 14 楼的回复,frps 不是有效的二进制文件,软链接指向更是错误的。
ysc3839
115 天前
@aloxaf 这是 journalctl 生成的,显示 blob data 是因为存在不可打印字符,可以用-a 参数显示
spencerseth44
115 天前
我之前也碰到过,不过我那次好像是文件权限问题,最后懒的查了,搞个脚本一分钟检查一次进程在不在,不在就 frps -c frps.ini 启一下
aru
115 天前
@snipes
15 和 16 楼已经说的很清楚了
重新下载 frp 软件包并解压
拷贝 frps 到 /usr/local/frps/ 目录下
删除错误的软链接文件
rm /usr/bin/frps
ln -s /usr/local/frps/frps /usr/bin/frps
snipes
113 天前
@aru 嗯,这样是可以的,可能是 FRP 安装脚本的问题,用那个脚本装,/usr/bin/frps 就是一个软链接。谢了。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://ex.noerr.eu.org/t/1124208

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX