frp通过自定义域名访问部署于内网的 web 服务

frp 的作用

  • 利用处于内网或防火墙后的机器,对外网环境提供 http 或 https 服务。
  • 对于 http, https 服务支持基于域名的虚拟主机,支持自定义域名绑定,使多个域名可以共用一个80端口。
  • 利用处于内网或防火墙后的机器,对外网环境提供 tcp 和 udp 服务,例如在家里通过 ssh 访问处于公司内网环境内的主机。

1、修改 frps.ini 文件,设置 http 访问端口为 8899端口,服务端配置frps.ini

[common]
bind_port = 7000
vhost_http_port = 8899

2、启动 frps

./frps -c ./frps.ini
后台启动
nohup ./frps -c ./frps.ini &

3、修改 frpc.ini 文件,假设 frps 所在的服务器的 IP 为47.75.65.222,local_port 为本地机器上 web 服务对应的端口, 绑定自定义域名 www.yourdomain.com:客户端配置frpc.ini

[common]
server_addr = 47.75.65.222
server_port = 7000

[ssh1]
type = tcp
local_ip = 172.16.3.52
local_port = 22
remote_port = 6100

[web11]
type = http
local_port = 9007
custom_domains = www.yourdomain.com
locations = /bbsp

[web21]
type = http
local_port = 9004
custom_domains = www.yourdomain.com
locations = /bbss

[web31]
type = http
local_port = 8055
custom_domains = www.yourdomain.com

4、启动 frpc

./frpc -c ./frpc.ini
后台启动
nohup ./frpc -c ./frpc.ini &

你可能感兴趣的:(frp通过自定义域名访问部署于内网的 web 服务)