mirror of
https://github.com/fatedier/frp.git
synced 2025-08-02 12:07:20 +00:00
update doc
This commit is contained in:
104
README_zh.md
104
README_zh.md
@@ -26,7 +26,11 @@ frp 是一个可用于内网穿透的高性能的反向代理应用,支持 tcp
|
||||
* [配置文件模版渲染](#配置文件模版渲染)
|
||||
* [Dashboard](#dashboard)
|
||||
* [Admin UI](#admin-ui)
|
||||
* [身份验证](#身份验证)
|
||||
* [监控](#监控)
|
||||
* [Prometheus](#prometheus)
|
||||
* [客户端身份验证](#客户端身份验证)
|
||||
* [Token](#token)
|
||||
* [OIDC](#oidc)
|
||||
* [加密与压缩](#加密与压缩)
|
||||
* [TLS](#tls)
|
||||
* [客户端热加载配置文件](#客户端热加载配置文件)
|
||||
@@ -48,6 +52,7 @@ frp 是一个可用于内网穿透的高性能的反向代理应用,支持 tcp
|
||||
* [通过密码保护你的 web 服务](#通过密码保护你的-web-服务)
|
||||
* [自定义二级域名](#自定义二级域名)
|
||||
* [URL 路由](#url-路由)
|
||||
* [TCP 端口复用类型](#tcp-端口复用类型)
|
||||
* [通过代理连接 frps](#通过代理连接-frps)
|
||||
* [范围端口映射](#范围端口映射)
|
||||
* [客户端插件](#客户端插件)
|
||||
@@ -459,9 +464,56 @@ admin_pwd = admin
|
||||
|
||||
如果想要在外网环境访问 Admin UI,将 7400 端口映射出去即可,但需要重视安全风险。
|
||||
|
||||
### 身份验证
|
||||
### 监控
|
||||
|
||||
服务端和客户端的 common 配置中的 `token` 参数一致则身份验证通过。
|
||||
frps 当启用 Dashboard 后,会默认开启内部的监控,数据存放在内存中,每次重启进程后会清空,监控数据可以通过 dashboard 的地址发送 HTTP 请求获取。
|
||||
|
||||
目前还支持 Prometheus 作为可选的监控系统。
|
||||
|
||||
#### Prometheus
|
||||
|
||||
在 `frps.ini` 中启用 Dashboard,并且设置 `enable_prometheus = true`,则通过 `http://{dashboard_addr}/metrics` 可以获取到 Prometheus 的监控数据。
|
||||
|
||||
### 客户端身份验证
|
||||
|
||||
目前 frpc 和 frps 之间支持两种身份验证方式,`token` 和 `oidc`。
|
||||
|
||||
通过 `frpc.ini` 和 `frps.ini` 中 `[common]` section 的 `authentication_method` 参数配置需要使用的验证方法。
|
||||
|
||||
`authenticate_heartbeats = true` 将会在每一个心跳包中附加上鉴权信息。
|
||||
|
||||
`authenticate_new_work_conns = true` 将会在每次建立新的工作连接时附加上鉴权信息。
|
||||
|
||||
#### Token
|
||||
|
||||
当 `authentication_method = token`,将会启用基于 token 的验证方式。
|
||||
|
||||
需要在 `frpc.ini` 和 `frps.ini` 的 `[common]` section 中设置相同的 `token`。
|
||||
|
||||
#### OIDC
|
||||
|
||||
当 `authentication_method = oidc`,将会启用基于 OIDC 的身份验证。
|
||||
|
||||
验证流程参考 [Client Credentials Grant](https://tools.ietf.org/html/rfc6749#section-4.4)
|
||||
|
||||
启用这一验证方式,配置 `frpc.ini` 和 `frps.ini` 如下:
|
||||
|
||||
```ini
|
||||
# frps.ini
|
||||
[common]
|
||||
authentication_method = oidc
|
||||
oidc_issuer = https://example-oidc-issuer.com/
|
||||
oidc_audience = https://oidc-audience.com/.default
|
||||
```
|
||||
|
||||
```ini
|
||||
[common]
|
||||
authentication_method = oidc
|
||||
oidc_client_id = 98692467-37de-409a-9fac-bb2585826f18 # Replace with OIDC client ID
|
||||
oidc_client_secret = oidc_secret
|
||||
oidc_audience = https://oidc-audience.com/.default
|
||||
oidc_token_endpoint_url = https://example-oidc-endpoint.com/oauth2/v2.0/token
|
||||
```
|
||||
|
||||
### 加密与压缩
|
||||
|
||||
@@ -487,6 +539,8 @@ use_compression = true
|
||||
|
||||
为了端口复用,frp 建立 TLS 连接的第一个字节为 0x17。
|
||||
|
||||
通过将 frps.ini 的 `[common]` 中 `tls_only` 设置为 true,可以强制 frps 只接受 TLS 连接。
|
||||
|
||||
**注意: 启用此功能后除 xtcp 外,不需要再设置 use_encryption。**
|
||||
|
||||
### 客户端热加载配置文件
|
||||
@@ -824,6 +878,50 @@ locations = /news,/about
|
||||
|
||||
按照上述的示例配置后,`web.yourdomain.com` 这个域名下所有以 `/news` 以及 `/about` 作为前缀的 URL 请求都会被转发到 web02,其余的请求会被转发到 web01。
|
||||
|
||||
### TCP 端口复用类型
|
||||
|
||||
frp 支持将单个端口收到的连接路由到不同的代理,类似 `vhost_http_port` 和 `vhost_https_port`。
|
||||
|
||||
目前支持的复用器只有 `httpconnect`。
|
||||
|
||||
当在 `frps.ini` 的 `[common]` 中设置 `tcpmux_httpconnect_port`,frps 将会监听在这个端口,接收 HTTP CONNECT 请求。
|
||||
|
||||
frps 会根据 HTTP CONNECT 请求中的 host 路由到不同的后端代理。
|
||||
|
||||
示例配置如下:
|
||||
|
||||
```ini
|
||||
# frps.ini
|
||||
[common]
|
||||
bind_port = 7000
|
||||
tcpmux_httpconnect_port = 1337
|
||||
```
|
||||
|
||||
```ini
|
||||
# frpc.ini
|
||||
[common]
|
||||
server_addr = x.x.x.x
|
||||
server_port = 7000
|
||||
|
||||
[proxy1]
|
||||
type = tcpmux
|
||||
multiplexer = httpconnect
|
||||
custom_domains = test1
|
||||
|
||||
[proxy2]
|
||||
type = tcpmux
|
||||
multiplexer = httpconnect
|
||||
custom_domains = test2
|
||||
```
|
||||
|
||||
通过上面的配置,frps 如果接收到 HTTP CONNECT 请求内容:
|
||||
|
||||
```
|
||||
CONNECT test1 HTTP/1.1\r\n\r\n
|
||||
```
|
||||
|
||||
该连接将会被路由到 proxy1 。
|
||||
|
||||
### 通过代理连接 frps
|
||||
|
||||
在只能通过代理访问外网的环境内,frpc 支持通过 HTTP PROXY 和 frps 进行通信。
|
||||
|
Reference in New Issue
Block a user