【问题标题】:How to specify public port to receive tcp connections with ngrok如何使用 ngrok 指定公共端口以接收 tcp 连接
【发布时间】:2021-06-11 23:46:42
【问题描述】:

我可以访问 ngrok 上的付费计划。我想在公共域上打开端口 9000。

我现在拥有的:

Session Status                online
Account                       ... (Plan: Pro)
Version                       2.3.35
Region                        United States (us)
Web Interface                 http://127.0.0.1:4040
Forwarding                    tcp://6.tcp.ngrok.io:19004 -> localhost:9000

Connections                   ttl     opn     rt1     rt5     p50     p90
                              0       0       0.00    0.00    0.00    0.00

我想要什么:

Session Status                online
Account                       ... (Plan: Pro)
Version                       2.3.35
Region                        United States (us)
Web Interface                 http://127.0.0.1:4040
Forwarding                    tcp://whatever.ngrok.io:9000 -> localhost:9000  <= public port is 9000

Connections                   ttl     opn     rt1     rt5     p50     p90
                              0       0       0.00    0.00    0.00    0.00

我可以创建自己的子域,如 foobar.eu.ngrok.io,我如何重用它并在其上打开端口 9000?

【问题讨论】:

    标签: ngrok


    【解决方案1】:

    您是否从文档中尝试过这个?

    ngrok tcp --region=us --remote-addr 1.tcp.ngrok.io:20301 22

    监听保留的远程地址

    通常,每次启动 TCP 隧道时都会随机分配远程地址和端口。对于生产服务(和便利),您通常需要一个稳定的、有保证的远程地址。为此,首先,登录到您的 ngrok.com 仪表板,然后单击“保留的 TCP 地址”部分中的“保留地址”。然后在调用 ngrok 时使用 -remote-addr 选项在您保留的 TCP 地址上绑定隧道。确保您指定的 -region 与您保留地址的区域相匹配。

    参考:https://ngrok.com/docs#tcp-remote-addr

    【讨论】:

    • 不,只在本地主机上使用 9000。我想要 tcp,而不是 http。
    • {port} will be assigned when you create the address. 我不想要随机端口,我需要 9000
    • 是的,通常它是随机分配的,但您可以在仪表板中保留地址并使用它
    • 好的,但是我该怎么做呢?我在仪表板中到处查看,我尝试了所有方法,但我做不到。
    猜你喜欢
    • 2016-08-18
    • 2020-10-19
    • 1970-01-01
    • 1970-01-01
    • 2019-11-10
    • 2023-02-12
    • 2010-09-17
    • 2012-01-12
    • 2016-03-13
    相关资源
    最近更新 更多