frp 内网穿透服务器搭建frps服务端和frpc客户端

全屏阅读
  • 基本信息
  • 作者:
  • 作者已发布:924篇文章
  • 发布时间:2022年11月01日 0:21:52
  • 所属分类:Linux
  • 阅读次数:578次阅读
  • 标签:

1 工具 一台具有公网ip的服务器

2 下载frp frp下载地址   https://github.com/fatedier/frp/releases

打开上面的frp下载地址

公网服务器上 打开下载文件

frps是服务端,在公网服务器上部署

frpc是客户端,在需要内网穿透的电脑上部署

frps配置 首先我这用的是win公网服务器 (linux和mac同样是编辑这个文件)里面的frps.ini文件

[common]
bind_addr = 0.0.0.0
bind_port = 2534
subdomain_host = xxx.xxx.xxx
token =Y2SEsBABxxx

dashboard_port = 16343
dashboard_user = yjx
dashboard_pwd = yjx

vhost_http_port = 1208

log_file = ./frps.log
log_level = error
log_max_days = 3
max_pool_count = 500
tcp_mux = true

阿里云解析配置

我是用的家里的路由器自动获取动态公网ip并更新到阿里云 云解析

需要修改的数据

bind_port = 2534 # 公网服务器爆漏的端口

subdomain_host = xxx.xxx.xxx #公网ip或者域名(访问多个web端必须使用域名,我用的域名,通过二级域名访问不同的本地web端(作用类似ngins里面的service_name),列bt40.xxx.xxx.xxx:1208, ng40.xxx.xxx.xxx:1208, kuboard40.xxx.xxx.xxx:1208)

token =Y2SEsBxxx #

dashboard_port = 16343 #frp服务器管理(可以看当前连接的服务)

dashboard_user = yjx #登录名

dashboard_pwd = yjx #登录密码

vhost_http_port = 1208 # web端爆漏的端口

修改frps.ini配置后启动 到cmd同目录执行

win版
 frps.exe -c frps.ini
 
mac版
./frps -c ./frps.ini

2. 启动好frps服务器后,在配置frpc客户端

打开
在这里插入图片描述

[common]
server_addr = xxx.xxx.xxx
server_port = 2524
token =Y2SEsBABxxx

[web01]
type = http
local_ip = 127.0.0.1
local_port = 88
custom_domains = bt40.xxx.xxx.xxx
locations = /
	
[web02]
type = http
local_ip = 127.0.0.1
local_port = 8
custom_domains = ng40.xxx.xxx
locations = /

[web03]
type = http
local_ip = 127.0.0.1
local_port = 30080
custom_domains = kuboard40.xxx.xxx
locations = /


[ssh]
type = tcp
local_port = 22
local_ip = 127.0.0.1
# 在服务端注册端口 服务端将监听 7022 ssh root@xxx.xxx.xxx -p 7022 即可代理到本机 ssh 登录
remote_port = 7022

[mysql]
type = tcp
local_ip = 127.0.0.1
local_port = 3306
remote_port = 6001

[redis]
type = tcp
local_ip = 127.0.0.1
local_port = 6379
remote_port = 6002

server_addr = xxx.xxx.xxx 必须和frps.ini的 subdomain_host 一致

server_port = 2524 必须和frps.ini的 bind_port 一致

token =Y2SEsBABxxx 必须和frps.ini的 token 一致

修改frpc.ini配置后启动 到cmd同目录执行

win版
 frpc.exe -c frpc.ini
 
mac版
./frpc -c ./frpc.ini

内网穿透即可完成

通过公网域名 xxx.xxx.xxx:6002 就可连接到本地的redis服务器

通过公网域名 xxx.xxx.xxx:6001 就可连接到本地的mysql服务器

通过公网域名 kuboard40.xxx.xxx:1208 就可访问本地的kuboard web端

3 查看当前使用用户连接,只能看看使用的用户连接,作用不大

通过xxx.xxx.xxx:16343查看当前所有内网穿透用户连接 16343是frps.ini里面配置的dashboard_port = 16343

密码账户是frps.ini 里面的。可以随便改

dashboard_user = yjx

dashboard_pwd = yjx

我丢,刚搭建好frp 又看到了更好用的nps

ngrok

https://github.com/inconshreveable/ngrok

frp

https://github.com/fatedier/frp

lanproxy

https://github.com/ffay/lanproxy

goproxy

https://github.com/snail007/goproxy

nps

https://github.com/cnlh/nps综合比较后发现nps比较符合需求,但是目前版本(0.23)存在稳定性问题,作者打算在未来版本收费  

顶一下
(0)
100%
订阅 回复
踩一下
(0)
100%
» 郑重声明:本文由mpxq168发布,所有内容仅代表个人观点。版权归恒富网mpxq168共有,欢迎转载, 但未经作者同意必须保留此段声明,并给出文章连接,否则保留追究法律责任的权利! 如果本文侵犯了您的权益,请留言。

目前有 0 条留言 其中:访客:0 条, 博主:0 条

给我留言

您必须 [ 登录 ] 才能发表留言!