ngrok 配置多个 http 隧道

2018-09-10 - 1,856 Views - 4 Goods - Nothing

客户端配置

ngrok 客户端配置文件 ngrok.cfg

server_addr: lekeopen.com:4443
trust_host_root_certs: false

tunnels: 
    tunnel1:
        subdomain: Example1
        proto:
            http: 80
    tunnel2:
        subdomain: Example2
        proto:
            http: 8080                
  • lekeopen.com 之前服务器端配置的域名
  • tunnel1,tunnel2为隧道名称,用于通过命令行来启动不同的隧道
  • http为这个隧道的协议,80为本地供外网访问的端口
  • subdomain 二级域名名称 (Example1.lekeopen.com 访问本地 localhost 80 端口站点;Example2.lekeopen.com 访问本地 localhost 8080 端口站点)

Nginx 不同网站设置不同端口访问

Example1 nginx Example1.conf

server {
  listen        80;
  server_name   localhost;
  root          /www/Example1;
  index         index.php index.html index.htm;
}

Example2 nginx Example2.conf

server {
  listen        8080;
  server_name   localhost;
  root          /www/Example2;
  index         index.php index.html index.htm;
}

执行

./ngrok -config ngrok.cfg start tunnel1 tunnel2

后台执行

nohup ./ngrok -config ngrok.cfg start tunnel1 tunnel2 &
转载请注明原文链接:首页 -> 日常 -> ngrok 配置多个 http 隧道
  • 微信打赏

AnHui.HuaiNan

我很感谢那些爱过我的人.