frp内网穿透

frp内网穿透

Server端(阿里云CentOS7)

1. 下载

wget https://github.com/fatedier/frp/releases/download/v0.22.0/frp_0.22.0_linux_amd64.tar.gz

2.tar解压到指定目录

3、编辑frps.ini文件

1
2
3
4
5
6
7
8
[common]
bind_port = 7000
dashboard_port = 7500
token = xxxxxxxx
dashboard_user = admin
dashboard_pwd = xxxxxx
vhost_http_port = 10080
vhost_https_port = 10443

token与客户端配置文件对应,用于安全验证。
bind_port即流量转发端口,用于中转内网流量
dashboard_port后管登录端口,user, pwd则为登录的账号密码。
vhost_http(s)_port,用于中转http(s)流量,此4个接口都需先在安全组中放开

4.运行

nohup ./frps -c frps.ini &


Client端(macOS Big Sur)

1.下载相应架构package

https://github.com/fatedier/frp/releases

2.编辑ini文件

1
2
3
4
5
6
7
8
9
10
[common]
server_addr = Server公网IP
server_port = 与Server端配置的bind_port一致
token = 与Server端配置的一致

[https]
type = https
local_ip = 127.0.0.1
local_port = 8888//本地服务端口
custom_domains = svinvy.com

3. node开启本地测试服务

1
2
3
4
5
6
7
8
9
10
11
var http = require('http');
var https = require('https')
,fs = require("fs");
var options = {
key: fs.readFileSync('./4670736_www/4670736_www.svinvy.com.key'),
cert: fs.readFileSync('./4670736_www/4670736_www.svinvy.com.pem')
};
https.createServer(options, function (req, res) {
res.writeHead(200);
res.end('hello world\n');
}).listen(8888,'127.0.0.1');

4.访问公网域名及端口

https://www.svinvy.com:10043

5.参考

https://sspai.com/post/52523
https://blog.csdn.net/u013144287/article/details/78589643/