首页 » 工具&API » ngrok客户端参数使用说明

ngrok客户端参数使用说明

 

ngrok客户端配置说明.

官方帮助

[root@localhost ngrok]# ./ngrok --help
Usage: ./ngrok [OPTIONS] <local port or address>
Options:
  -authtoken string
        Authentication token for identifying an ngrok.com account
  -config string
        Path to ngrok configuration file. (default: $HOME/.ngrok)
  -hostname string
        Request a custom hostname from the ngrok server. (HTTP only) (requires CNAME of your DNS)
  -httpauth string
        username:password HTTP basic auth creds protecting the public tunnel endpoint
  -log string
        Write log messages to this file. 'stdout' and 'none' have special meanings (default "none")
  -log-level string
        The level of messages to log. One of: DEBUG, INFO, WARNING, ERROR (default "DEBUG")
  -proto string
        The protocol of the traffic over the tunnel {'http', 'https', 'tcp'} (default: 'http+https') (default "http+https")
  -subdomain string
        Request a custom subdomain from the ngrok server. (HTTP only)

Examples:
    ngrok 80
    ngrok -subdomain=example 8080
    ngrok -proto=tcp 22
    ngrok -hostname="example.com" -httpauth="user:password" 10.0.0.1


Advanced usage: ngrok [OPTIONS] <command> [command args] [...]
Commands:
    ngrok start [tunnel] [...]    Start tunnels by name from config file
    ngork start-all               Start all tunnels defined in config file
    ngrok list                    List tunnel names from config file
    ngrok help                    Print help
    ngrok version                 Print ngrok version

Examples:
    ngrok start www api blog pubsub
    ngrok -log=stdout -config=ngrok.yml start ssh
    ngrok start-all
    ngrok version

实例

server_addr: ngrok.zuobin.net:4443
trust_host_root_certs: false

tunnels:
  #带auth
  authweb:
    auth: "user:psw123"
    proto:
      http: 8080
  #普通穿透    
  web:
    proto:
      http: 8080
  #带auth转发到别的IP和端口    
  webforward:
    auth: "user:psw123"
    proto:
      http: 192.168.2.201:8080
  #tcp转发到ssh端口    
  ssh:
    proto:
      tcp: 22
  #转发tcp    
  sshforward:
    proto:
      tcp: 192.168.2.202:22
  #cname到别的域名    
  webcname:
    proto: http
    auth: "user:psw123"
    addr: 80
    hostname: demo.example.com

开启所有转发

ngrok -config=ngrok.cfg start-all

开启指定配置

ngrok -config=ngrok.cfg start authweb

指定不需要日志

ngrok -log=none -config=ngrok.cfg start web

指定日志路径和level

ngrok -log=/var/log/ngrok/ngrok.log -log-level=INFO -config=ngrok.cfg start web



原文链接:ngrok客户端参数使用说明,转载请注明来源!

0