使用frp内网穿透

1、背景,有一台阿里云的服务器,有公网ip。但是服务器配置不高,无法同时运行多个服务以供项目调试。如果有内网穿透就可以将服务搭在本地的服务器上,依然可以通过外网访问。阿里云服务器是centos7.2,本地服务器是windows
2、下载frp:
https://github.com/fatedier/frp/releases
这里写图片描述
图片不是很准确,我下载的是linux_amd64.tar.gz和windows_amd64.zip,分别对应linux和windows
下载解压后有如下的七个文件:
这里写图片描述
3、需要安装golang的运行环境
http://www.runoob.com/go/go-environment.html
4、配置服务器端
非常简单,vi frps.ini。
[common]
bind_port = 8096
bind_addr = 0.0.0.0
auto_token = frp
vhost_http_port = 3389
参数分别对应:
bind_port = 8096 #服务器跟客户端连接的端口
bind_addr = 0.0.0.0 #绑定服务器地址
auto_token = frp
vhost_http_port = 3389 #http类型的端口
配置完成,启动服务:
./frps -c ./frps.ini
这里写图片描述
启动完成。下一步配置客户端
5、配置客户端:
解压windows_amd64.zip,然后修改frpc.ini:
[common]
server_addr = xxx.xxx.xxx.xxx
server_port = 8096
auto_token = frp
[web]
type = http
local_ip = 127.0.0.1
local_port = 8085
remote_port = 3288
custom_domains = xxx.xxx.xxx.xxx
参数分别对应:
[common]
server_addr = xxx.xxx.xxx.xxx #服务器地址
server_port = 8096 #连接的服务器端口
auto_token = frp
[web]
type = http
local_ip = 127.0.0.1
local_port = 8085
remote_port = 3288 #服务器http类型的对应端口
custom_domains = xxx.xxx.xxx.xxx #服务器的域名,没有域名也可以直接填服务器的ip
在cmd命令行中启动服务:
frpc -c frpc.ini
OK,访问服务器http://xxx.xxx.xxx.xxx:3288/就可以访问到内网的服务了。

[common]
server_addr = xxx.xxx.xxx.xxx
server_port = 9901
token = xxx


[web01]
type = http
local_port = 8011
remote_port = 9905
custom_domains = xxx.xxx.xxx.xxx
locations = /

[web02]
type = http
local_port = 8184
remote_port = 9905
custom_domains = xxx.xxx.xxx.xxx
locations = /news,/compare
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值