0%

ngrok使用记录

简介
之所以在众多的正向代理服务和反向代理软件中选择ngrok,有两个原因

  1. 使用golang实现,代码简洁易懂
  2. 配置简单一目了然
    当然本文只介绍如何部署

代码下载

git clone https://github.com/inconshreveable/ngrok.git

代码编译

  • 客户端 go build main/ngrok/ngrok.go
  • 服务器 go build main/ngrokd/ngrokd.go

服务器配置

1
2
3
# supervisord
command=/root/ngrokd --tunnelAddr=":9002" --domain="192.168.1.1"

客户端配置

1
2
3
4
5
6
7
8
server_addr: 192.168.1.1:9002
trust_host_root_certs: false
tunnels:
aliyun:
hostname: 192.168.1.1
remote_port: 2200
proto:
tcp: 22

备注

在反向代理ssh时请注意安全,更改默认端口,不允许root权限登录改用证书登录