git clone https://github.com/inconshreveable/ngrok cd ngrok make # 服务端 mv ./ngrokd /usr/bin/ngrokd # 客户端 mv ./ngrok /usr/bin/ngrok echo"" > $HOME/.ngrok
使用
Server
ngrokd大意是ngrok daemon,顾名思义是服务端。查看帮助
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
[email protected]:~/tmp/ngrok/bin# ./ngrokd --help Usage of ./ngrokd: -domain string Domain where the tunnels are hosted (default "ngrok.com") -httpAddr string Public address for HTTP connections, empty string to disable (default ":80") -httpsAddr string Public address listening for HTTPS connections, emptry string to disable (default ":443") -log string Write log messages to this file. 'stdout' and 'none' have special meanings (default "stdout") -log-level string The level of messages to log. One of: DEBUG, INFO, WARNING, ERROR (default "DEBUG") -tlsCrt string Path to a TLS certificate file -tlsKey string Path to a TLS key file -tunnelAddr string Public address listening for ngrok client (default ":4443")
[email protected]:~/Tools/port_map/ngrok/bin$ ./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)
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