内网穿透服务搭建基于go语言的frp(或者node的cros)

一、frp工具搭建

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

服务端配置

# frps.ini 配置

[common]
bind_port = 7000
vhost_http_port = 7001
token = ***************************  #你的token
subdomain_host = cros.abc.cn   #你的泛解析域名


# nginx 域名配置(如果要使用域名穿透)
server {
    listen 80;
    server_name *.cros.abc.cn;
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host:80;
        proxy_set_header X-Nginx-Proxy true;
        proxy_set_header Connection "";
        proxy_pass http://127.0.0.1:7001;
    }
}

客户端配置

frpc.ini 配置

[common]
server_addr = ***.**.**.** #服务器IP
server_port = 7000  #服务端口
token = *******************  #服务端设置的token

# http内网穿透设置
[hzh-wxmp]
type = http
local_ip = 192.168.8.106
local_port = 8080
subdomain = hzh-wxmp

# ssh内网穿透设置
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000

启动命令
服务端:nohup ./frps -c ./frps.ini > start.log 2>&1 &
客户端:nohup ./frpc -c ./frpc.ini > start.log 2>&1 &

二、cros工具搭建

项目地址 https://github.com/zhihuihu/cros
具体配置按照readme文件进行配置即可,推荐采用脚手架进行服务端和客户端部署

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容