molezz BAR - ngrok
type: channel
link: https://www.molezz.net/tag/ngrok/
items: ngrok 编译服务器客户端设置

ngrok 编译服务器客户端设置
type: item
date: 2016-05-22T03:28:12+00:00
description: 服务端编译需要go1.6+, 下载源码git clone https://github.com/inconshreveable/ngrok.git ngrok cd ngrok生成证书NGROK_DOMAIN="xxxx.com" openssl genrsa -out base.key 2048 openssl req -new -x509 -nodes -key base.key -days 10000 -subj "/CN=$NGROK_DOMAIN" -out base.pem openssl genrsa -out server.key 2048 openssl req -new -key server.key -subj "/CN=$NGROK_DOMAIN" -out server.csr openssl x509 -req -in server.csr -CA base.pem -CAkey base.key -CAcreateserial -days 10000 -out server.crt cp base.pem assets/client/tls/ngrokroot.crt编译, 完成后ngrok和ngrokd位于bin下sudo make release-server release-client启动服务器sudo ./bin/ngrokd -tlsKey=server.key -tlsCrt=server.crt -domain="xxxx.com" -httpAddr=":8081" -httpsAddr=":8082"32位或者arm客户端再编译, 位于bin下的Linux_arm下sudo GOOS=linux GOARCH=arm make release-client客户端启动, 80端口调试直接运行./ngrok -config ngrok.cfg -subdomain www2 80tcp 端口转发 编辑 ngrok.cfgserver_addr: "ngrok.natapp.cn:4443" trust_host_root_certs: false tunnels: ssh: remote_port: 48822 proto: tcp: 22 web: remote_port: 80 proto: tcp: 80运行./ngrok -config ngrok.cfg start ssh webgvm 安装 goRequirementssudo apt-get install curl git mercurial make binutils bison gcc build-essentialinstallbash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)install go 1.6.2gvm install go1.4 -B gvm use go1.4 export GOROOT_BOOTSTRAP=$GOROOT gvm install go1.6.2