【问题标题】:Tunnel not found未找到隧道
【发布时间】:2019-02-02 06:10:23
【问题描述】:

我正在使用ngrok 1 客户端和服务器来建立到本地主机的隧道。

我运行 the script 在服务器端编译 ngrokd 和 ngrok:

NGROK_DOMAIN="my-domain.com"
git clone https://github.com/inconshreveable/ngrok.git
cd ngrok

openssl genrsa -out rootCA.key 2048
openssl req -x509 -new -nodes -key rootCA.key -subj "/CN=$NGROK_DOMAIN" -days 5000 -out rootCA.pem
openssl genrsa -out device.key 2048
openssl req -new -key device.key -subj "/CN=$NGROK_DOMAIN" -out device.csr
openssl x509 -req -in device.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out device.crt -days 5000

cp rootCA.pem assets/client/tls/ngrokroot.crt
# make clean
make release-server release-client

我运行服务器:

bin/ngrokd -tlsKey=device.key -tlsCrt=device.crt -domain="$NGROK_DOMAIN" -httpAddr=":8000" -httpsAddr=":8001"

然后我将刚刚编译好的 ngrok 下载到客户端。 我创建客户端配置:

NGROK_DOMAIN="my-domain.com"
echo -e "server_addr: $NGROK_DOMAIN:4443\ntrust_host_root_certs: false" > ngrok-config

并运行客户端:

./ngrok -config=ngrok-config 80

而且显示在线:

Tunnel Status                 online                                                                                                                                                 
Version                       1.7/1.7                                                                                                                                                
Forwarding                    http://4f2e0a1e.:8000 -> 127.0.0.1:80                                                                                                                  
Forwarding                    https://4f2e0a1e.:8000 -> 127.0.0.1:80                                                                                                                 
Web Interface                 127.0.0.1:4040                                                                                                                                         
# Conn                        0                                                                                                                                                      
Avg Conn Time                 0.00ms

然后我请求http://4f2e0a1e.my-domain.com:8000 期望它将请求传递给我的localhost:80

curl http://4f2e0a1e.my-domain.com:8000

但反应是:

Tunnel 4f2e0a1e.my-domain.com:8000 not found

在服务器上,我在 curl 请求后立即看到日志:

[08:59:15 MSK 2019/02/02] [INFO] (ngrok/log.(*PrefixLogger).Info:83) [pub:1ca51d1c] New connection from myClientIp:63169
[08:59:15 MSK 2019/02/02] [DEBG] (ngrok/log.(*PrefixLogger).Debug:79) [pub:1ca51d1c] Found hostname 4f2e0a1e.my-domain.com:8000 in request
[08:59:15 MSK 2019/02/02] [INFO] (ngrok/log.(*PrefixLogger).Info:83) [pub:1ca51d1c] No tunnel found for hostname 4f2e0a1e.my-domain.com:8000
[08:59:15 MSK 2019/02/02] [DEBG] (ngrok/log.(*PrefixLogger).Debug:79) [pub:1ca51d1c] Closing

【问题讨论】:

    标签: ngrok


    【解决方案1】:

    我得到了这个问题的最终和最终解决方案!

    1. 忘记您的旧帐户并创建一个新帐户 Ngrok
    2. 只需按照 ngrok 将新的身份验证配置添加到您的终端 文档here
    3. 就是这样,现在像往常一样开始你的隧道。它会起作用的 在 WAN 上很好。

    【讨论】:

      【解决方案2】:

      实际上,$NGROK_DOMAIN 一行是空的

      bin/ngrokd -tlsKey=device.key -tlsCrt=device.crt -domain="$NGROK_DOMAIN" -httpAddr=":8000" -httpsAddr=":8001"
      

      在我设置 NGROK_DOMAIN=my-domain.com 后,它开始正常工作。

      【讨论】:

        【解决方案3】:

        您可以使用 VMWare 工作站代替 oracle 虚拟机 我敢肯定,它会起作用的。 我也面临 ngrok 隧道错误。

        【讨论】:

          猜你喜欢
          • 2020-06-26
          • 2020-06-23
          • 2021-05-03
          • 2021-05-04
          • 2011-08-01
          • 2022-12-30
          • 1970-01-01
          相关资源
          最近更新 更多