frp 内网穿透配置

下载frp到服务器,在 https://github.com/fatedier/frp/releases 这里可以查看最新版本和获取下载地址

 

修改服务器配置文件(frps.ini):

vi frps.ini

 

按i,进行编辑,将内容修改下面的:

 

[common]
#与客户端绑定的进行通信的端口
bind_port = 7000
#http的访问端口
vhost_http_port = 80
#https的访问端口(如果需要的话)
vhost_https_port = 8080
[ssh]
listen_port = 6000
auth_token = 123

[web]
type = http
custom_domains = test1.a.com
auth_token = 123
[web2]
type = http
custom_domains = test2.a.com
auth_token = 123



[common] 必须设置
bind_port 是自己设定的frp服务端端口
vhost_http_port 是自己设定的http访问端口
[ssh] ssh反向代理(不是必须设置)
listen_port 是自己设定的ssh访问端口
auth_token用于身份认证(以下皆是)。
[web] http反向代理[]里的内容可以自己设定,但是客户端和服务端必须要对应(如[aaa],[bbb]);
type 为服务类型,可以设为http,https
custom_domains为要映射的域名,记得域名的A记录要解析到外网主机的IP。
[web2]同上(可设置多个)
 
 
 

 

 

按Esc键,退出编辑,再按:wq保存退出。

5.启动frp服务端:

方法一: 启动命令(这种方式不推荐,因为断开与服务器的SSH连接后,frp也就停止运行了):

./frps -c ./frps.ini





编辑frpc.ini文件,内容如下:

[common]
server_addr = 你的服务器地址
#与服务端绑定的进行通信的端口
server_port = 7000

[web]
type = http
#本地映射的端口,比如开了个tomcat apache,端口为8080
local_port = 8080
remote_port = 80
#域名必须要有,并解析到你的服务器地址
custom_domains = test.com

frpc.exe -c frpc.ini

 

[common]
server_addr = 10.10.10.10
server_port = 7000
auth_token = 123
[ssh]
local_port = 22
[web]
type = http
local_port = 80
[web2]
type = http
local_port = 8080

 

[common]必填
server_addrfrp服务端的ip(也就是外网主机的IP)
server_portfrp服务端的bind_prot。
[ssh]
local_port客户端ssh端口。
[web]
type对应服务端配置
local_port客户端访问端口。
[web2]同上


 
posted @ 2018-05-24 21:32  狂猫  阅读(638)  评论(0编辑  收藏  举报