frp: 配置指南
frp 配置
安装
因为是
go
语言开发的,下载解压即可
- 服务端 (外网服务器)
- 客户端( 我们自己的电脑 )
# linux 端
https://github.com/fatedier/frp/releases/download/v0.51.3/frp_0.51.3_linux_amd64.tar.gz
# mac 端
https://github.com/fatedier/frp/releases/download/v0.51.3/frp_0.51.3_darwin_amd64.tar.gz
步骤
- 域名范解析
- 添加记录,生成范解析证书
- 配置 server
- 配置 client
域名解析
frp server
frps -c frps.ini
[common]
bind_port = 7000
vhost_http_port = 80
vhost_https_port = 443
token = 123123
subdomain_host = frp.js.work
frp client
frpc -c frpc.ini
[common]
server_addr = 103.96.148.144
server_port = 7000
token = 123123
[web]
type = http
local_ip = 127.0.0.1
local_port = 3000
subdomain = t1
[test_htts2http]
type = https
; custom_domains = t1.frp.js.work
subdomain = t1
plugin = https2http
plugin_local_addr = 127.0.0.1:3000
plugin_crt_path = ./ssl/frp.js.work/fullchain1.pem
plugin_key_path = ./ssl/frp.js.work/privkey1.pem
plugin_host_header_rewrite = 127.0.0.1
plugin_header_X-From-Where = frp
cheatsheet
各种常用的配置场景,可利用
mkcert
生成域名证书。
- 电脑安装: mkcert -install
- 特定的域名: mkcert t1.frt.saybot.net
[common]
server_addr = frp.saybot.net
server_port = 7000
token = YOUR_TOKEN
场景 | client |
---|---|
http(单域名) |
|
http(泛域名) |
|
https(单域名) http://frp.saybot.net |
|
https(泛域名) https://t1.frp.saybot.net |
|