frp 服务端详细配置说明。

基础配置

参数类型说明默认值可选值备注

bind_addrstring服务端监听地址0.0.0.0

bind_portint服务端监听端口7000接收 frpc 的连接

kcp_bind_portint服务端监听 KCP 协议端口0用于接收采用 KCP 连接的 frpc

quic_bind_portint服务端监听 QUIC 协议端口0用于接收采用 QUIC 连接的 frpc

quic_keepalive_periodintquic 协议 keepalive 间隔,单位: 秒10

quic_max_idle_timeoutintquic 协议的最大空闲超时时间,单位: 秒30

quic_max_incoming_streamsintquic 协议最大并发 stream 数100000

proxy_bind_addrstring代理监听地址同 bind_addr可以使代理监听在不同的网卡地址

log_filestring日志文件地址./frps.log如果设置为 console,会将日志打印在标准输出中

log_levelstring日志等级infotrace, debug, info, warn, error

log_max_daysint日志文件保留天数3

disable_log_colorbool禁用标准输出中的日志颜色false

detailed_errors_to_clientbool服务端返回详细错误信息给客户端true

tcp_mux_keepalive_intervalinttcp_mux 的心跳检查间隔时间60单位:秒

tcp_keepaliveint和客户端底层 TCP 连接的 keepalive 间隔时间,单位秒7200负数不启用

heartbeat_timeoutint服务端和客户端心跳连接的超时时间90单位:秒

user_conn_timeoutint用户建立连接后等待客户端响应的超时时间10单位:秒

udp_packet_sizeint代理 UDP 服务时支持的最大包长度1500服务端和客户端的值需要一致

tls_cert_filestringTLS 服务端证书文件路径

tls_key_filestringTLS 服务端密钥文件路径

tls_trusted_ca_filestringTLS CA 证书路径

nat_hole_analysis_data_reserve_hoursint打洞策略数据的保留时间168

权限验证

参数类型说明默认值可选值备注

authentication_methodstring鉴权方式tokentoken, oidc

authenticate_heartbeatsbool开启心跳消息鉴权false

authenticate_new_work_connsbool开启建立工作连接的鉴权false

tokenstring鉴权使用的 token 值客户端需要设置一样的值才能鉴权通过

oidc_issuerstringoidc_issuer

oidc_audiencestringoidc_audience

oidc_skip_expiry_checkbooloidc_skip_expiry_check

oidc_skip_issuer_checkbooloidc_skip_issuer_check

管理配置

参数类型说明默认值可选值备注

allow_portsstring允许代理绑定的服务端端口格式为 1000-2000,2001,3000-4000

max_pool_countint最大连接池大小5

max_ports_per_clientint限制单个客户端最大同时存在的代理数00 表示没有限制

tls_onlybool只接受启用了 TLS 的客户端连接false

Dashboard, 监控

参数类型说明默认值可选值备注

dashboard_addrstring启用 Dashboard 监听的本地地址0.0.0.0

dashboard_portint启用 Dashboard 监听的本地端口0

dashboard_userstringHTTP BasicAuth 用户名

dashboard_pwdstringHTTP BasicAuth 密码

dashboard_tls_modebool是否启用 TLS 模式false

dashboard_tls_cert_filestringTLS 证书文件路径

dashboard_tls_key_filestringTLS 密钥文件路径

enable_prometheusbool是否提供 Prometheus 监控接口false需要同时启用了 Dashboard 才会生效

asserts_dirstring静态资源目录Dashboard 使用的资源默认打包在二进制文件中,通过指定此参数使用自定义的静态资源

pprof_enablebool启动 Go HTTP pproffalse用于应用调试

HTTP & HTTPS

参数类型说明默认值可选值备注

vhost_http_portint为 HTTP 类型代理监听的端口0启用后才支持 HTTP 类型的代理,默认不启用

vhost_https_portint为 HTTPS 类型代理监听的端口0启用后才支持 HTTPS 类型的代理,默认不启用

vhost_http_timeoutintHTTP 类型代理在服务端的 ResponseHeader 超时时间60

subdomain_hoststring二级域名后缀

custom_404_pagestring自定义 404 错误页面地址

TCPMUX

参数类型说明默认值可选值备注

tcpmux_httpconnect_portint为 TCPMUX 类型代理监听的端口0启用后才支持 TCPMUX 类型的代理,默认不启用

tcpmux_passthroughbool是否透传 CONNECT 请求false通常在本地服务是 HTTP Proxy 时使用