frp web应用 内网穿透

关于frp配置文件的其他东西,后续用到了再补充。

场景:

有一个windows(内网)上运行的web应用,我需要可以通过公网访问。

解决方案:

1 修改toml文件内容:

1.1 frps、frps.toml放在公网服务器上。

frps.toml文件内容:

bindPort = 7000
vhostHTTPPort = 86

 7000是握手端口,和frpc.toml中的serverPort要相同。

vhostHTTPPort是用户访问的端口,和frpc.toml中的remotePort要相同。

1.2 frpc、frpc.toml放在内网机器(如windows电脑)。

frpc.toml:

serverAddr = "xxx.xxx.xxx.xxx"
serverPort = 7000

[[proxies]]
name = "web"
type = "http"
localPort = 5000
remotePort = 86
customDomains = ["xxx.xxx.xxx.xxx"]

其中"xxx.xxx.xxx.xxx"替换为公网服务器ip;

localPort为内网web应用运行的端口;

2 运行server端和client端:

2.1 server端:

后台运行

nohup ./frps -c frps.toml &

其他:

 查看后台运行的进程

jobs

 查看frp相关进程

ps -aux | grep 'frp'

杀死进程(-9是强制杀死 后面的94036根据实际pid修改) 

kill -9 94036
2.2 client端:

到对应目录下,cmd运行

.\frpc.exe -c frpc.toml

3 访问xxx.xxx.xxx.xxx:86,成功

  • 9
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值