frp安装
2021-01-18 本文已影响0人
诺之林
云服务
wget https://github.com/fatedier/frp/releases/download/v0.34.3/frp_0.34.3_linux_amd64.tar.gz
tar xf frp_0.34.3_linux_amd64.tar.gz && cd frp_0.34.3_linux_amd64
vim frps.ini
# [common]
# bind_port = 7000
# vhost_http_port = 80
sudo ./frps -c ./frps.ini
保证云服务安全组入站规则允许上述端口
内网服务
vim app.js
var http = require("http");
var server = http.createServer((request, response) => {
// 发送 HTTP 头部
// HTTP 状态值: 200 : OK
// 内容类型: text/plain
response.writeHead(200, { 'Content-Type': 'text/plain' });
// 请求的响应数据
response.end('Hello World');
})
server.listen(30000); // 监听30000端口
console.log('Server running at http://127.0.0.1:30000/')
node app.js
wget https://github.com/fatedier/frp/releases/download/v0.34.3/frp_0.34.3_darwin_amd64.tar.gz
tar xf frp_0.34.3_darwin_amd64.tar.gz && cd frp_0.34.3_darwin_amd64
vim frpc.ini
# [common]
# server_addr = **
# server_port = 7000
#
# [web]
# type = http
# local_port = 30000
# custom_domains = git.nuozhilin.site
./frpc -c ./frpc.ini
curl git.nuozhilin.site
# Hello World
保证域名git.nuozhilin.site解析至server_addr