#官方文件链接如下:
https://gofrp.org/docs/reference/server-configures/
视频教程
服务端配置
frp 服务端详细配置说明,官方的极简设置只要设置红色 bind_port即可。
稍微复杂点可以选择紫色的条目
基础配置
| 参数 | 类型 | 说明 | 默认值 | 可选值 | 备注 |
|---|
| bind_addr | string | 服务端监听地址 | 0.0.0.0 | | |
| bind_port | int | 服务端监听端口 | 7000 | | 接收 frpc 的连接 |
| bind_udp_port | int | 服务端监听 UDP 端口 | 0 | | 用于辅助创建 P2P 连接 |
| kcp_bind_port | int | 服务端监听 KCP 协议端口 | 0 | | 用于接收采用 KCP 连接的 frpc |
| proxy_bind_addr | string | 代理监听地址 | 同 bind_addr | | 可以使代理监听在不同的网卡地址 |
| log_file | string | 日志文件地址 | ./frps.log | | 如果设置为 console,会将日志打印在标准输出中 |
| log_level | string | 日志等级 | info | trace, debug, info, warn, error | |
| log_max_days | int | 日志文件保留天数 | 3 | | |
| disable_log_color | bool | 禁用标准输出中的日志颜色 | false | | |
| detailed_errors_to_client | bool | 禁用服务端返回详细错误信息给客户端 | true | | |
| heart_beat_timeout | int | 服务端和客户端心跳连接的超时时间 | 90 | | 单位:秒 |
| user_conn_timeout | int | 用户建立连接后等待客户端响应的超时时间 | 10 | | 单位:秒 |
权限验证
| 参数 | 类型 | 说明 | 默认值 | 可选值 | 备注 |
|---|
| authentication_method | string | 鉴权方式 | token | token, oidc | |
| authenticate_heartbeats | bool | 开启心跳消息鉴权 | false | | |
| authenticate_new_work_conns | bool | 开启建立工作连接的鉴权 | false | | |
| token | string | 鉴权使用的 token 值 | | | 客户端需要设置一样的值才能鉴权通过 |
| oidc_issuer | string | oidc_issuer | | | |
| oidc_audience | string | oidc_audience | | | |
| oidc_skip_expiry_check | bool | oidc_skip_expiry_check | | | |
| oidc_skip_issuer_check | bool | oidc_skip_issuer_check | | | |
管理配置
| 参数 | 类型 | 说明 | 默认值 | 可选值 | 备注 |
|---|
| allow_ports | string | 允许代理绑定的服务端端口 | | | 格式为 1000-2000,2001,3000-4000 |
| max_pool_count | int | 最大连接池大小 | 5 | | |
| max_ports_per_client | int | 限制单个客户端最大同时存在的代理数 | 0 | | 0 表示没有限制 |
| tls_only | bool | 只接受启用了 TLS 的客户端连接 | false | | |
Dashboard, 监控
| 参数 | 类型 | 说明 | 默认值 | 可选值 | 备注 |
|---|
| dashboard_addr | string | 启用 Dashboard 监听的本地地址 | 0.0.0.0 | | |
| dashboard_port | int | 启用 Dashboard 监听的本地端口 | 0 | | |
| dashboard_user | string | HTTP BasicAuth 用户名 | admin | | |
| dashboard_pwd | string | HTTP BasicAuth 密码 | admin | | |
| enable_prometheus | bool | 是否提供 Prometheus 监控接口 | false | | 需要同时启用了 Dashboard 才会生效 |
| asserts_dir | string | 静态资源目录 | | | Dashboard 使用的资源默认打包在二进制文件中,通过指定此参数使用自定义的静态资源 |
HTTP & HTTPS
| 参数 | 类型 | 说明 | 默认值 | 可选值 | 备注 |
|---|
| vhost_http_port | int | 为 HTTP 类型代理监听的端口 | 0 | | 启用后才支持 HTTP 类型的代理,默认不启用 |
| vhost_https_port | int | 为 HTTPS 类型代理监听的端口 | 0 | | 启用后才支持 HTTPS 类型的代理,默认不启用 |
| vhost_http_timeout | int | HTTP 类型代理在服务端的 ResponseHeader 超时时间 | 60 | | |
| subdomain_host | string | 二级域名后缀 | | | |
| custom_404_page | string | 自定义 404 错误页面地址 | | | |
TCPMUX
| 参数 | 类型 | 说明 | 默认值 | 可选值 | 备注 |
|---|
| tcpmux_httpconnect_port | int | 为 TCPMUX 类型代理监听的端口 | 0 | | 启用后才支持 TCPMUX 类型的代理,默认不启用 |
目前使用的frps.ini
[common]
bind_addr=0.0.0.0
bind_port =7000
vhost_http_port =666
token=omv5
dashboard_port =7500
# dashboard 用户名密码,默认都为 admin 本处已经修改
dashboard_user =admin
dashboard_pwd =omv5