NutzCN Logo
精华 社区福利: Ngrok内网穿透
发布于 665天前 作者 wendal 10679 次浏览 复制 上一个帖子 下一个帖子
标签: ngrok

想在外网访问你机器上的demo? ngrok估计是最好的选择

但ngrok早已经被墙, 原因你懂的

so, Nutz社区提供一个ngrok服务, 供各位nutz使用者享用

当然, 无可避免的有一点限制条件:

  1. 使用Github登陆
  2. Nutz的使用者 -- 当然,我不能校验这个,靠自觉吧
  3. 不可以部署非法应用, 大流量应用

准备好了吗? 访问下来地址吧

Ngrok内网穿透福利

93 回复

这个福利要点 +1024赞

下载配置文件(ngrok.yml)
是ngrok.xml 吧?

@vincentwong109 y,写错说明了,哈哈

附上ngrok服务器端的代码, 在原版基础上增加

  1. redis存储auth_token, 从而禁止匿名登陆
  2. 代理http/https时,强制使用auth_token关联的用户地址,禁止自定义域名及随机域名
  3. 将统计数据存入redis, 该数据仅包含全局统计数据.

https://github.com/wendal/ngrok

@gitleonine1989 待会我发个网盘地址吧

@wendal 成了。不太懂网络,这是叫端口映射么

@gitleonine1989 不是, 端口映射一般指同一个网络内的行为(路由器-->局域网机器)

这东西跟我大学时候写的一个概念,当时放弃了...

https://code.google.com/p/preproxy/

@wendal 我是半路出家的猿基础不扎实啊。看到文档里提到隧道协议这个名词,想起vpn来了。兽总大学时一定是学霸,鉴定完毕。

域名已经更改为 wendal.cn , 请重新下载配置文件.

已经显示online了,那已经是成功了

来自炫酷的 NutzCN

squid跟ngrok完全两码事

二话不说先点赞

自己的digitalocean还有2个月,我也搭建了个.
你们试试能用不?
http://pan.baidu.com/s/1jH1TBaI

@wendal 这个福利还在么?

@wendal 哦,需要登录,thx

而且速度很不错

为什么这个回复的btn 像转发?

来自 iPhone 6S

@fangjingping 每个人的审美不一样导致的,哈哈

好用! 可以继续之前落下的微信公众号开发了。。。。

@crskyp 点"配置文件"

QQ图片20160416190817_png 我想问问这个里面zjlwm我的用户名称在怎么获取的呢

如果是github登录的话,那就是你的github用户名

@wendal 可是登陆我只在社区nutz.cn登陆了下啊,然后下载合格命令执行了下就完成了,这个他还会自动去扫描我登陆社区没有吗

配置文件里面有token,服务器上的ngork限定了该token只能映射到指定的子域名。

@wendal 终于反应过了,那个下载配置文件里面的token 是根据登陆信息动态生成的吧。 反应慢了点。

linux包下载下来没有ngrok.yml文件阿

"linux包", 那是ngork本身, 怎么可能带ngrok.yml, 就算有,也不是nutz.cn提供的版本

http://nutz.cn/ngrok/me 里面的"配置文件" 才是下载ngork.yml的链接.

server_addr: wendal.cn:4443
trust_host_root_certs: true
auth_token: q3p3lj6duojdrqu9pi603o63g3
tunnels:
httpbin:
proto: http
addr: 80
sshbin:
proto: tcp
addr: 22

./ngrok -config ngrok.yml start httpbin
Tunnel httpbin does not specify any protocols to tunnel.

help why?

http://pastebin.com/gJDBvXs2

这个格式有问题吗?请执教

httpbin是什么玩意?

ngrok --config ngrok.yml 8080

httpbin和sshbin都是tunnels的别名阿
不可以吗?

@zingers 没有意义。nutz.cn提供的ngrok服务,每个帐号只能映射一个固定域名的http隧道。

@wendal ngrok 停了? 一直 Tunnel Status : reconnecting

@shevawen 你网络的问题...

get,兽总棒棒哒

ngrok.yml
这个配置文件在哪里下载的啊 找了半天没看到哦

找到了 不好意思

@sofeik 下载链接的名字叫 (配置文件)

来自炫酷的 NutzCN

现已全面支持https访问!!! 全面支持微信小程序的https/wss协议的要求.

直接换成https即可访问

https://wendal.ngrok.wendal.cn/nutzbook/yvr/list

真金白银的付费https泛域名证书, 非自签名证书, 没有https证书警告!!!

佩服的五体投地

ngrok -config ngrok.yml 8080

@wendal 为什么我的启动后就只有一个http的地址,没有https呢?

@wendal

ngrok

Tunnel Status                 online
Version                       1.7/1.7
Forwarding                    http://xxxx.ngrok.wendal.cn:9080 -> 127.0.0.1:8080
Web Interface                 127.0.0.1:4040
# Conn                        0
Avg Conn Time                 1.59ms

HTTP Requests
-------------

GET /nutzbook/rs/logo.png     200 OK

没有https的

Forwarding                    https://xxxx.ngrok.wendal.cn:9080 -> 127.0.0.1:8080

https服务已关闭, 一直没人用.

用的人还是有的,比如还有我

回家提交代码到公司服务器

这个不错哦,搞公众号开发,必备的呢,哈哈

端口换成4443了 修改yml端口号

@wendal 怎么拿到自己的auth_token

@qq_c1bab051 看自己的个人主页

@wendal

# nutz社区福利 https://nutz.cn/yvr/t/33b68q9106imspallbj4c6aa0p
auth_token=u4p3j5eabug47o7f7cubci63**
# 本地要映射到80的端口,比如你启动服务端口为9090那就填写9090
to_port=8081
# 其他参数请参考项目说明后自行添加 https://github.com/nutzam/nutzmore/tree/master/nutz-plugins-ngrok

我在个人主页上扫描微信,获得auth_token,在windows系统下直接点击bywendal.bat启动,
一直失败,叫我检查token,下载了ngrok.yml,但是没看懂怎么用,求指教。

access token是手机客户端用的,要用下载的ngrok.yml

nutz-plugins-ngrok.properties
中的auth_token怎么配置,还有

ngrok -config ngrok.yml 8080

我是windows7系统,不能再cmd下直接执行。。。

你到底用哪款客户端

我重新下载了ngrok_win这个版本,需要ngrok.yml吗,这里面只有ngrok.exe

把ngrok.yml里面token,填到properties文件里面

@wendal
好的,成功了,十分感谢。

谢谢分享,真的很赞! 666

nutz社区福利 https://nutz.cn/yvr/t/33b68q9106imspallbj4c6aa0p

auth_token=2maea0rbaejqqqrvt4i783jnga

本地要映射到80的端口,比如你启动服务端口为9090那就填写9090

to_port=4443

其他参数请参考项目说明后自行添加 https://github.com/nutzam/nutzmore/tree/master/nutz-plugins-ngrok

2017-7-24 11:10:45.167 DEBUG [pool-1-thread-14] start socket pipe ...
2017-7-24 11:10:46.191 DEBUG [pool-1-thread-14] bab bad!! can't acccess local po
rt
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.(Unknown Source)
at java.net.Socket.(Unknown Source)
at org.nutz.plugins.ngrok.client.NgrokClient.newSocket2Local(NgrokClient
.java:239)
at org.nutz.plugins.ngrok.client.NgrokClient$ProxyConn.call(NgrokClient.
java:297)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

to_port的值应该怎么写??

-to_port=8080

改成8080后也是配置失败,还是跟上面一样的错误

贴你的完整命令

D:\chromedownload\weixin\ngrok客户端>bywendal.bat

D:\chromedownload\weixin\ngrok客户端>java -cp nutz-plugins-ngrok.jar org.nutz.pl
ugins.ngrok.client.NgrokClient -conf_file=nutz-plugins-ngrok.properties
2017-7-24 11:22:21.85 INFO [main] Select SystemLog as Nutz.Log implement
2017-7-24 11:22:21.333 DEBUG [main] Locations for Scans:
[Dir[path=D:\chromedownload\weixin\ngrok客户端], Jar[path=D:\chromedownload\weix
in\ngrok%e5%ae%a2%e6%88%b7%e7%ab%af\nutz-plugins-ngrok.jar], Jar[path=D:\chromed
ownload\weixin\ngrok客户端\nutz-plugins-ngrok.jar]]
2017-7-24 11:22:21.349 INFO [main] same resource path [k客户端/nutz-plugins-ngro
k.properties](nutz-plugins-ngrok.properties/ D:\chromedownload\weixin\ngrok客户
端\nutz-plugins-ngrok.properties) will be override by nutz-plugins-ngrok.proper
ties

2017-7-24 11:22:21.369 DEBUG [main] Found 2 resource by src( nutz-plugins-ngrok.
properties ) , regex( ^.+[.]properties$ )
2017-7-24 11:22:21.376 DEBUG [main] config key=auth_token value=2maea0rbaejqqqrv
t4i783jnga
2017-7-24 11:22:21.395 DEBUG [main] config key=to_port value=8080
2017-7-24 11:22:21.492 DEBUG [main] Using 95 castor for Castors
2017-7-24 11:22:23.208 DEBUG [pool-1-thread-1] write msg = {"Type":"Auth","Paylo
ad":{"Version":"2","MmVersion":"1.7","User":"2maea0rbaejqqqrvt4i783jnga","Passwo
rd":"","OS":"windows","Arch":"386","ClientId":""}}
2017-7-24 11:22:24.235 DEBUG [pool-1-thread-1] read msg = {"Type":"AuthResp","Pa
yload":{"Version":"2","MmVersion":"1.7","ClientId":"tc0vjoevr4j6bqv5mqbv1uk1cd",
"Error":""}}
2017-7-24 11:22:24.240 DEBUG [pool-1-thread-1] write msg = {"Type":"ReqTunnel","
Payload":{"ReqId":"02jh6nf1s2h2lorvsdmkghcueu","Protocol":"http","Hostname":"","
Subdomain":"","HttpAuth":"","RemotePort":0}}
2017-7-24 11:22:24.872 DEBUG [pool-1-thread-1] read msg = {"Type":"NewTunnel","P
ayload":{"ReqId":"02jh6nf1s2h2lorvsdmkghcueu","Url":"http://wx_re04g36pgtit0mc6f
l1u.ngrok.wendal.cn","Protocol":"http","Error":""}}
2017-7-24 11:22:24.877 DEBUG [pool-1-thread-1] ReqId=02jh6nf1s2h2lorvsdmkghcueu
URL=http://wx_re04g36pgtit0mc6fl1u.ngrok.wendal.cn
2017-7-24 11:22:24.881 DEBUG [pool-1-thread-1] read msg = {"Type":"NewTunnel","P
ayload":{"ReqId":"02jh6nf1s2h2lorvsdmkghcueu","Url":"http://wxzre04g36pgtit0mc6f
l1u.ngrok.wendal.cn","Protocol":"http","Error":""}}
2017-7-24 11:22:24.888 DEBUG [pool-1-thread-1] ReqId=02jh6nf1s2h2lorvsdmkghcueu
URL=http://wxzre04g36pgtit0mc6fl1u.ngrok.wendal.cn
2017-7-24 11:22:30.309 DEBUG [pool-1-thread-1] read msg = {"Type":"ReqProxy","Pa
yload":{"ReqId":"02jh6nf1s2h2lorvsdmkghcueu","Url":"http://wxzre04g36pgtit0mc6fl
1u.ngrok.wendal.cn","Protocol":"http","Error":""}}
2017-7-24 11:22:30.309 DEBUG [pool-1-thread-1] read msg = {"Type":"ReqProxy","Pa
yload":{"ReqId":"02jh6nf1s2h2lorvsdmkghcueu","Url":"http://wxzre04g36pgtit0mc6fl
1u.ngrok.wendal.cn","Protocol":"http","Error":""}}
2017-7-24 11:22:30.325 DEBUG [pool-1-thread-1] read msg = {"Type":"ReqProxy","Pa
yload":{"ReqId":"02jh6nf1s2h2lorvsdmkghcueu","Url":"http://wxzre04g36pgtit0mc6fl
1u.ngrok.wendal.cn","Protocol":"http","Error":""}}
2017-7-24 11:22:30.325 DEBUG [pool-1-thread-1] read msg = {"Type":"ReqProxy","Pa
yload":{"ReqId":"02jh6nf1s2h2lorvsdmkghcueu","Url":"http://wxzre04g36pgtit0mc6fl
1u.ngrok.wendal.cn","Protocol":"http","Error":""}}
2017-7-24 11:22:30.341 DEBUG [pool-1-thread-1] read msg = {"Type":"ReqProxy","Pa
yload":{"ReqId":"02jh6nf1s2h2lorvsdmkghcueu","Url":"http://wxzre04g36pgtit0mc6fl
1u.ngrok.wendal.cn","Protocol":"http","Error":""}}
2017-7-24 11:22:30.372 DEBUG [pool-1-thread-3] write msg = {"Type":"RegProxy","P
ayload":{"ClientId":"tc0vjoevr4j6bqv5mqbv1uk1cd"}}
2017-7-24 11:22:30.387 DEBUG [pool-1-thread-5] write msg = {"Type":"RegProxy","P
ayload":{"ClientId":"tc0vjoevr4j6bqv5mqbv1uk1cd"}}
2017-7-24 11:22:30.387 DEBUG [pool-1-thread-4] write msg = {"Type":"RegProxy","P
ayload":{"ClientId":"tc0vjoevr4j6bqv5mqbv1uk1cd"}}
2017-7-24 11:22:30.434 DEBUG [pool-1-thread-6] write msg = {"Type":"RegProxy","P
ayload":{"ClientId":"tc0vjoevr4j6bqv5mqbv1uk1cd"}}
2017-7-24 11:22:30.434 DEBUG [pool-1-thread-7] write msg = {"Type":"RegProxy","P
ayload":{"ClientId":"tc0vjoevr4j6bqv5mqbv1uk1cd"}}
2017-7-24 11:22:31.169 DEBUG [pool-1-thread-3] read msg = {"Type":"StartProxy","
Payload":{"Url":"http://wxzre04g36pgtit0mc6fl1u.ngrok.wendal.cn","ClientAddr":""
}}
2017-7-24 11:22:31.169 DEBUG [pool-1-thread-3] start socket pipe ...
2017-7-24 11:22:32.214 DEBUG [pool-1-thread-3] bab bad!! can't acccess local por
t
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.(Unknown Source)
at java.net.Socket.(Unknown Source)
at org.nutz.plugins.ngrok.client.NgrokClient.newSocket2Local(NgrokClient
.java:239)
at org.nutz.plugins.ngrok.client.NgrokClient$ProxyConn.call(NgrokClient.
java:297)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

回复按钮旁边就是 "插入代码或日志片段" 的按钮!!!

你本地端口是啥?? 难道不是8080?

D:\chromedownload\weixin\ngrok客户端>bywendal.bat
D:\chromedownload\weixin\ngrok客户端>java -cp nutz-plugins-ngrok.jar org.nutz.pl
ugins.ngrok.client.NgrokClient -conf_file=nutz-plugins-ngrok.properties
2017-7-24 11:31:11.671 INFO [main] Select SystemLog as Nutz.Log implement
2017-7-24 11:31:11.919 DEBUG [main] Locations for Scans:
[Dir[path=D:\chromedownload\weixin\ngrok客户端], Jar[path=D:\chromedownload\weix
in\ngrok%e5%ae%a2%e6%88%b7%e7%ab%af\nutz-plugins-ngrok.jar], Jar[path=D:\chromed
ownload\weixin\ngrok客户端\nutz-plugins-ngrok.jar]]
2017-7-24 11:31:11.935 INFO [main] same resource path [k客户端/nutz-plugins-ngro
k.properties](nutz-plugins-ngrok.properties/ D:\chromedownload\weixin\ngrok客户
端\nutz-plugins-ngrok.properties) will be override by nutz-plugins-ngrok.proper
ties

2017-7-24 11:31:11.951 DEBUG [main] Found 2 resource by src( nutz-plugins-ngrok.
properties ) , regex( ^.+[.]properties$ )
2017-7-24 11:31:11.959 DEBUG [main] config key=auth_token value=2maea0rbaejqqqrv
t4i783jnga
2017-7-24 11:31:11.974 DEBUG [main] config key=to_port value=8080
2017-7-24 11:31:12.44 DEBUG [main] Using 95 castor for Castors
2017-7-24 11:31:14.641 DEBUG [pool-1-thread-1] write msg = {"Type":"Auth","Paylo
ad":{"Version":"2","MmVersion":"1.7","User":"2maea0rbaejqqqrvt4i783jnga","Passwo
rd":"","OS":"windows","Arch":"386","ClientId":""}}
2017-7-24 11:31:15.867 DEBUG [pool-1-thread-1] read msg = {"Type":"AuthResp","Pa
yload":{"Version":"2","MmVersion":"1.7","ClientId":"2p94fsbkn4j6gruh55gq2l18pi",
"Error":""}}
2017-7-24 11:31:15.873 DEBUG [pool-1-thread-1] write msg = {"Type":"ReqTunnel","
Payload":{"ReqId":"6ng46qnhtmhb7rblaefk6vuro6","Protocol":"http","Hostname":"","
Subdomain":"","HttpAuth":"","RemotePort":0}}
2017-7-24 11:31:16.257 DEBUG [pool-1-thread-1] read msg = {"Type":"NewTunnel","P
ayload":{"ReqId":"6ng46qnhtmhb7rblaefk6vuro6","Url":"http://wx_re04g36pgtit0mc6f
l1u.ngrok.wendal.cn","Protocol":"http","Error":""}}
2017-7-24 11:31:16.260 DEBUG [pool-1-thread-1] ReqId=6ng46qnhtmhb7rblaefk6vuro6
URL=http://wx_re04g36pgtit0mc6fl1u.ngrok.wendal.cn
2017-7-24 11:31:16.263 DEBUG [pool-1-thread-1] read msg = {"Type":"NewTunnel","P
ayload":{"ReqId":"6ng46qnhtmhb7rblaefk6vuro6","Url":"http://wxzre04g36pgtit0mc6f
l1u.ngrok.wendal.cn","Protocol":"http","Error":""}}
2017-7-24 11:31:16.265 DEBUG [pool-1-thread-1] ReqId=6ng46qnhtmhb7rblaefk6vuro6
URL=http://wxzre04g36pgtit0mc6fl1u.ngrok.wendal.cn
2017-7-24 11:31:22.911 DEBUG [pool-1-thread-1] read msg = {"Type":"ReqProxy","Pa
yload":{"ReqId":"6ng46qnhtmhb7rblaefk6vuro6","Url":"http://wxzre04g36pgtit0mc6fl
1u.ngrok.wendal.cn","Protocol":"http","Error":""}}
2017-7-24 11:31:22.927 DEBUG [pool-1-thread-1] read msg = {"Type":"ReqProxy","Pa
yload":{"ReqId":"6ng46qnhtmhb7rblaefk6vuro6","Url":"http://wxzre04g36pgtit0mc6fl
1u.ngrok.wendal.cn","Protocol":"http","Error":""}}
2017-7-24 11:31:22.942 DEBUG [pool-1-thread-1] read msg = {"Type":"ReqProxy","Pa
yload":{"ReqId":"6ng46qnhtmhb7rblaefk6vuro6","Url":"http://wxzre04g36pgtit0mc6fl
1u.ngrok.wendal.cn","Protocol":"http","Error":""}}
2017-7-24 11:31:22.942 DEBUG [pool-1-thread-1] read msg = {"Type":"ReqProxy","Pa
yload":{"ReqId":"6ng46qnhtmhb7rblaefk6vuro6","Url":"http://wxzre04g36pgtit0mc6fl
1u.ngrok.wendal.cn","Protocol":"http","Error":""}}
2017-7-24 11:31:22.942 DEBUG [pool-1-thread-1] read msg = {"Type":"ReqProxy","Pa
yload":{"ReqId":"6ng46qnhtmhb7rblaefk6vuro6","Url":"http://wxzre04g36pgtit0mc6fl
1u.ngrok.wendal.cn","Protocol":"http","Error":""}}
2017-7-24 11:31:23.254 DEBUG [pool-1-thread-6] write msg = {"Type":"RegProxy","P
ayload":{"ClientId":"2p94fsbkn4j6gruh55gq2l18pi"}}
2017-7-24 11:31:23.254 DEBUG [pool-1-thread-4] write msg = {"Type":"RegProxy","P
ayload":{"ClientId":"2p94fsbkn4j6gruh55gq2l18pi"}}
2017-7-24 11:31:23.254 DEBUG [pool-1-thread-5] write msg = {"Type":"RegProxy","P
ayload":{"ClientId":"2p94fsbkn4j6gruh55gq2l18pi"}}
2017-7-24 11:31:23.254 DEBUG [pool-1-thread-7] write msg = {"Type":"RegProxy","P
ayload":{"ClientId":"2p94fsbkn4j6gruh55gq2l18pi"}}
2017-7-24 11:31:23.254 DEBUG [pool-1-thread-3] write msg = {"Type":"RegProxy","P
ayload":{"ClientId":"2p94fsbkn4j6gruh55gq2l18pi"}}
2017-7-24 11:31:25.844 DEBUG [pool-1-thread-4] read msg = {"Type":"StartProxy","
Payload":{"Url":"http://wxzre04g36pgtit0mc6fl1u.ngrok.wendal.cn","ClientAddr":""
}}
2017-7-24 11:31:25.844 DEBUG [pool-1-thread-4] start socket pipe ...
2017-7-24 11:31:45.446 INFO [pool-1-thread-8] srv2loc 19570ms 0kb
2017-7-24 11:31:45.446 DEBUG [pool-1-thread-4] proxy conn exit first at srv2loc
2017-7-24 11:31:45.446 INFO [pool-1-thread-9] loc2srv 19586ms 11kb

```

不报无法连接本地端口的错误了,但是还是配置失败

配置失败是啥意思

接口配置信息
请填写接口配置信息,此信息需要你有自己的服务器资源,填写的URL需要正确响应微信发送的Token验证,请阅读消息接口使用指南。
URL http://wxzre04g36pgtit0mc6fl1u.ngrok.wendal.cn
Token 2maea0rbaejqqqrvt4i783jnga
提交

点完提交后,一直弹出配置失败

你把ngrok的token跟微信的token混淆了?

auth_token 在哪呢?

添加回复
请先登陆
回到顶部