Ngrok 客戶端連接配置

HTTP 配置

# ngrok 服務器域名及端口
server_addr: ngrok.sprainkle.com:4000
# 如果使用自簽名證書,設為false
trust_host_root_certs: false
# 禁用 Web UI,不禁用的話,運行時間長的話會有問題
web_addr: false
tunnels:
  # 若 subdomain 未配置,子域名默認使用該值
  tunnel1:
    # 子域名
    subdomain: tunnel1 
    proto:
      # 代理本地服務,端口為 8080
      http: 8080
  tunnel2:
    # 支持多級子域名
    subdomian: sub.tunnel
    proto:
      # 代理遠程服務器,host:port
      http: 192.168.0.100:8080

TCP 配置

server_addr: ngrok.sprainkle.com:4000
trust_host_root_certs: false
tunnels:
  # 當使用 TCP 協議,不用配置 subdomian 
  tunnel3:
    # ngrok 服務器端口,選填
    remote_port: 2345
    proto:
      # 本地端口
      tcp: 2345

合并

server_addr: ngrok.sprainkle.com:4000
trust_host_root_certs: false
tunnels:
  tunnel1:
    subdomain: tunnel1 
    proto:
      http: 8080
  tunnel2:
    subdomian: sub.tunnel
    proto:
      http: 192.168.0.100:8080
  tunnel3:
    remote_port: 2345
    proto:
      tcp: 2345

啟動

# 全部啟動
./ngrok -config ngrok_test.cfg start-all
start-all
# 只啟動部分
./ngrok -config ngrok_test.cfg start tunnel1 tunnel2
start

推薦

手把手教你搭建ngrok服務-輕松外網調試內網服務
ngrok 1.x 內存泄露 bug 的解決方案

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容