frp配置

使用frp穿透公网ip访问本地代码,方便代码调试开发。

frp分客户端和服务端

客户端配置

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
[common]
# 配置远程服务器公网IP
server_addr = 123.56.222.243
server_port = 7000

log_file = ./frpc.log
log_level = info
log_max_days = 3

privilege_token = 12345678

admin_addr = 127.0.0.1
admin_port = 7400
admin_user = admin
admin_pwd = admin

pool_count = 5

tcp_mux = true

user = test

login_fail_exit = true

protocol = tcp

# 访问子域名wechat,端口9002
[wechat]
type = http
local_ip = 127.0.0.1
local_port = 9002
use_encryption = false
use_compression = false
subdomain = wechat

启动本地frp

1
./frpc -c frpc_full.ini

服务端配置

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
[common]
bind_addr = 0.0.0.0
bind_port = 7000

kcp_bind_port = 7000

# 默认80端口,使用nginx代理frp8888端口
vhost_http_port = 8888

dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = admin

log_file = ./frps.log
log_level = info
log_max_days = 3

privilege_token = 12345678
privilege_allow_ports = 2000-3000,3001,3003,4000-50000

max_pool_count = 5
authentication_timeout = 900

# 服务器域名
subdomain_host = dillonliang224.com

tcp_mux = true

启动服务器frp

1
./frps -c frps_full.ini

其他

通过访问wechat.dillonliang224.com, nginx代理转发至frp端口8888, 实现frp穿透.

如果不使用nginx, 修改vhost_http_port = 80 端口即可。