内网穿透工具Frp配置文件说明

内网穿透工具Frp开源地址:https://github.com/fatedier/frp (opens new window)

开发者配置文档:https://gofrp.org (opens new window)

# 客户端配置文件完整中文说明(v0.34.0)


# [common]是整数部分
[common]
# 必须包含IPv6的文字地址或主机名
# 用方括号括起来,例如“ [:: 1]:80”,“ [ipv6-host]:http”或“ [ipv6-host%zone]:80”
server_addr = 0.0.0.0
server_port = 7000

# 如果您想通过http代理或socks5代理连接frps,则可以在此处或在全局环境变量中设置http_proxy
# 仅在协议为tcp时有效
# http_proxy = http://user:passwd@192.168.1.128:8080
# http_proxy = socks5://user:passwd@192.168.1.128:1080

# 控制台或真实的logFile路径,例如./frpc.log
log_file = ./frpc.log

# trace, debug, info, warn, error
log_level = info

log_max_days = 3

# 在log_file为控制台时禁用日志颜色,默认为false
disable_log_color = false

# 用于身份验证
token = 12345678

# 通过http api设置控制frpc动作的管理地址,例如reload
admin_addr = 127.0.0.1
admin_port = 7400
admin_user = admin
admin_pwd = admin
# 管理资产目录。默认情况下,这些资产与frpc捆绑在一起。
# asset_dir = ./static

# 连接将提前建立,默认值为零
pool_count = 5

# 如果使用tcp流多路复用,默认为true,它必须与frps相同
tcp_mux = true

# 您的代理名称将更改为{user}.{proxy}
user = your_name

# 决定第一次登录失败时是否退出程序,否则连续重新登录到frps
# 默认为true
login_fail_exit = true

# 用于连接服务器的通信协议
# 现在它支持tcp,kcp和websocket,默认为tcp
protocol = TCP

# 如果tls_enable为true,则frpc将通过tls连接frps
tls_enable = true

# 指定一个dns服务器,因此frpc将使用此服务器代替默认服务器
# dns_server = 8.8.8.8

# 您要开始的个代理名称,以“,”分隔
# 默认为空,表示所有代理
# start = ssh,dns

# heartbeat configure,不建议修改默认值
# heartbeat_interval的默认值为10,heartbeat_timeout为90
# heartbeat_interval = 30
# heartbeat_timeout = 90

# 客户端的其他元信息
meta_var1 = 123
meta_var2 = 234

# 'ssh'是唯一的代理名称
# 如果[common]部分中的用户不为空,则它将更改为{user}.{proxy},例如'your_name.ssh'
[ssh]
# tcp | udp | http | https | stcp | xtcp,默认为tcp
type = tcp
local_ip = 127.0.0.1
local_port = 22
# 限制此代理的带宽,单位为KB和MB
bandwidth_limit = 1MB
# true或false,如果为true,则将对frps和frpc之间的消息进行加密,默认为false
use_encryption = false
# 如果为true,邮件将被压缩
use_compression = false
# 远程端口通过frps侦听
remote_port = 6001
# frps将为同一组中的代理负载平衡连接
group = test_group
# 组应该具有相同的组密钥
group_key = 123456
# 启用后端服务的运行状况检查,它现在支持'tcp'和'http'
# frpc将连接本地服务的端口以检测其健康状态
health_check_type = TCP
# 运行状况检查连接超时
health_check_timeout_s = 3
# 如果连续3次失败,则代理将从frps中删除
health_check_max_failed = 3
# 每10秒进行一次健康检查
health_check_interval_s = 10
# 每个代理的其他元信息
meta_var1 = 123
meta_var2 = 234

[ssh_random]
type = tcp
local_ip = 127.0.0.1
local_port = 22
# 如果remote_port为0,则frps将为您分配一个随机端口
remote_port = 0

# 如果要公开多个端口,请在节名称前添加'range:'前缀
# frpc将生成多个代理,例如'tcp_port_6010','tcp_port_6011'等。
[range:tcp_port]
type = tcp
local_ip = 127.0.0.1
local_port = 6010-6020,6022,6024-6028
remote_port = 6010-6020,6022,6024-6028
use_encryption = false
use_compression = false

[DNS]
type = udp
local_ip = 114.114.114.114
local_port = 53
remote_port = 6002
use_encryption = false
use_compression = false

[range:udp_port]
type = udp
local_ip = 127.0.0.1
local_port = 6010-6020
remote_port = 6010-6020
use_encryption = false
use_compression = false

# 将域名解析为[server_addr],以便可以使用 http://web01.yourdomain.com 浏览web01和使用 http://web02.yourdomain.com 浏览web02
[web01]
type = http
local_ip = 127.0.0.1
local_port = 80
use_encryption = false
use_compression = true
# http用户名和密码是http协议的安全认证
# 如果未设置,则无需认证即可访问此custom_domains
http_user = admin
http_pwd = admin
# 如果frps的域是frps.com,则可以通过URL http://test.frps.com 访问[web01]代理
subdomain = web01
custom_domains = web02.yourdomain.com
# 个位置仅适用于http类型
locations = /,/pic
host_header_rewrite = example.com
# 带有前缀“ header_”的参数将用于更新http请求标头
header_X-From-Where = frp
health_check_type = http
# frpc将GET HTTP请求'/ status'发送到本地http服务
# http服务在返回2xx http响应代码时仍处于活动状态
health_check_url = /status
health_check_interval_s = 10
health_check_max_failed = 3
health_check_timeout_s = 3

[web02]
type = https
local_ip = 127.0.0.1
local_port = 8000
use_encryption = false
use_compression = false
subdomain = web01
custom_domains = web02.yourdomain.com
# 如果不为空,则frpc将使用代理协议将连接信息传输到您的本地服务
# v1或v2或为空
proxy_protocol_version = v2

[plugin_unix_domain_socket]
type = tcp
remote_port = 6003
# 如果定义了插件,则local_ip和local_port无效
# 插件将处理从frps获得的连接
plugin = unix_domain_socket
# 插件需要前缀“ plugin_”的参数
plugin_unix_path = /var/run/docker.sock

[plugin_http_proxy]
type = tcp
remote_port = 6004
plugin = http_proxy
plugin_http_user = abc
plugin_http_passwd = abc

[plugin_socks5]
type = tcp
remote_port = 6005
plugin = socks5
plugin_user = abc
plugin_passwd = abc

[plugin_static_file]
type = tcp
remote_port = 6006
plugin = static_file
plugin_local_path = /var/www/blog
plugin_strip_prefix = static
plugin_http_user = abc
plugin_http_passwd = abc

[plugin_https2http]
type = https
custom_domains = test.yourdomain.com
plugin = https2http
plugin_local_addr = 127.0.0.1:80
plugin_crt_path = ./server.crt
plugin_key_path = ./server.key
plugin_host_header_rewrite = 127.0.0.1
plugin_header_X-From-Where = frp

[plugin_http2https]
type = http
custom_domains = test.yourdomain.com
plugin = http2https
plugin_local_addr = 127.0.0.1:443
plugin_host_header_rewrite = 127.0.0.1
plugin_header_X-From-Where = frp

[secret_tcp]
# 如果类型为secret tcp,则remote_port无效
# 谁想连接本地端口,应该使用stcp代理部署另一个frpc,角色是visitor
type = stcp
# sk用于访客身份验证
sk = abcdefg
local_ip = 127.0.0.1
local_port = 22
use_encryption = false
use_compression = false

# frpc的用户在stcp服务器和stcp访问者中应该相同
[secret_tcp_visitor]
# frpc角色访问者-> frps-> frpc角色服务器
role = visitor
type = stcp
# 您要访问的服务器名称
server_name = secret_tcp
sk = abcdefg
# 将此地址连接到访客stcp服务器
bind_addr = 127.0.0.1
bind_port = 9000
use_encryption = false
use_compression = false

[p2p_tcp]
type = xtcp
sk = abcdefg
local_ip = 127.0.0.1
local_port = 22
use_encryption = false
use_compression = false

[p2p_tcp_visitor]
role = visitor
type = xtcp
server_name = p2p_tcp
sk = abcdefg
bind_addr = 127.0.0.1
bind_port = 9001
use_encryption = false
use_compression = false

[tcpmuxhttpconnect]
type = tcpmux
multiplexer = httpconnect
local_ip = 127.0.0.1
local_port = 10701
custom_domains = tunnel1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275

# 服务端配置文件完整中文说明(v0.34.0)


#[common]是整数部分
[common]
#必须包含IPv6的文字地址或主机名
#用方括号括起来,例如“ [:: 1]:80”,“ [ipv6-host]:http”或“ [ipv6-host%zone]:80”
bind_addr = 0.0.0.0
bind_port = 7000

#udp端口有助于使udp孔穿透nat
bind_udp_port = 7001

#用于kcp协议的udp端口,可以与'bind_port'相同
#如果未设置,则以frps禁用kcp
kcp_bind_port = 7000

#指定要侦听的地址代理,默认值与bind_addr相同
#proxy_bind_addr = 127.0.0.1

#如果要支持虚拟主机,则必须设置用于侦听的http端口(可选)
#注意:http端口和https端口可以与bind_port相同
vhost_http_port = 80
vhost_https_port = 443

#vhost http服务器的响应标头超时(秒),默认为60s
#vhost_http_timeout = 60

# TcpMuxHttpConnectPort指定服务器侦听TCP的端口
# HTTP CONNECT请求。 如果值为0,则服务器将不会多路传输TCP
# 在单个端口上的个请求。 如果不是,它将在此值上监听
# HTTP CONNECT请求。 默认情况下,此值为0
# tcpmux_httpconnect_port = 1337

#设置dashboard_addr和dashboard_port以查看frps的仪表板
#dashboard_addr的默认值与bind_addr相同
#只有设置了dashboard_port,仪表板才可用
dashboard_addr = 0.0.0.0
dashboard_port = 7500

#仪表板用户和passwd用于基本身份验证保护,如果未设置,则两个默认值均为admin
dashboard_user = admin
dashboard_pwd = admin

# enable_prometheus将在/metrics api中的{dashboard_addr}:{dashboard_port}上导出prometheus指标。
enable_prometheus = true

#仪表板资产目录(仅适用于调试模式)
#asset_dir = ./static
#控制台或真实的logFile路径,例如./frps.log
log_file = ./frps.log

#跟踪,调试,信息,警告,错误
log_level = info

log_max_days = 3

#在log_file为控制台时禁用日志颜色,默认为false
disable_log_color = false

# DetailedErrorsToClient定义是否将特定错误(带有调试信息)发送到frpc。 默认情况下,此值为true。
detailed_errors_to_client = true

# AuthenticationMethod指定使用哪种身份验证方法对frps进行frpc身份验证。
# 如果指定了“令牌”-令牌将被读入登录消息。
# 如果指定了“ oidc”-将使用OIDC设置发行OIDC(开放ID连接)令牌。 默认情况下,此值为“令牌”。
authentication_method = token

# AuthenticateHeartBeats指定是否在发送给frps的心跳中包括身份验证令牌。 默认情况下,此值为false。
authenticate_heartbeats = false

# AuthenticateNewWorkConns指定是否在发送到frps的新工作连接中包括身份验证令牌。 默认情况下,此值为false。
authenticate_new_work_conns = false

#身份验证令牌
token = 12345678

# OidcClientId指定在AuthenticationMethod ==“oidc”时,用于在OIDC身份验证中获取令牌的客户端ID。
# 默认情况下,此值为“”。
oidc_client_id =

# OidcClientSecret指定如果AuthenticationMethod ==“oidc”,则用于在OIDC身份验证中获取令牌的客户端密码。
# 默认情况下,此值为“”。
oidc_client_secret = 

# OidcAudience如果AuthenticationMethod ==“ oidc”,则指定OIDC身份验证中令牌的受众。 默认情况下,此值为“”。
oidc_audience = 

# OidcTokenEndpointUrl指定实现OIDC令牌端点的URL。
# 如果AuthenticationMethod ==“oidc”,它将用于获取OIDC令牌。 默认情况下,此值为“”。
oidc_token_endpoint_url = 

#heartbeat configure,不建议修改默认值
#heartbeat_timeout的默认值为90
#heartbeat_timeout = 90

#仅允许frpc绑定您列出的端口,如果不进行任何设置,则没有任何限制
allow_ports = 2000-3000,3001,3003,4000-50000

#如果每个代理中的pool_count超过最大值,它将更改为max_pool_count
max_pool_count = 5

#最大端口可用于每个客户端,默认值为0表示无限制
max_ports_per_client = 0

#TlsOnly指定是否仅接受TLS加密的连接。 默认情况下,该值为false。
tls_only = false

#如果subdomain_host不为空,则可以在frpc的配置文件中将类型设置为http或https时设置子域
#当测试子域时,路由使用的主机是test.frps.com
subdomain_host = frps.com

#如果使用tcp流多路复用,则默认为true
tcp_mux = true

#HTTP请求的定制404页面
#custom_404_page = /path/to/404.html

[plugin.user-manager]
addr = 127.0.0.1:9000
path = /handler
ops = Login

[plugin.port-manager]
addr = 127.0.0.1:9001
path = /handler
ops = NewProxy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126