LoginSignup
1
2

More than 5 years have passed since last update.

Homebrew Caskでlocal環境にLAN外からアクセスできるようにするNgrokをインストールする

Posted at
  • 環境
    • macOS Mojave バージョン10.14.1
    • Homebrew 1.8.6

Homebrewでインストール前の準備をする。

# アップデートする。
$ brew update
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae

# 健康診断する。
$ brew doctor
Your system is ready to brew.

# Ngrokを探す
$ brew search ngrok
==> Casks
ngrok

If you meant "ngrok" specifically:
Upstream sunsetted 1.x in March 2016 and 2.x is not open-source.

If you wish to use the 2.x release you can install with Homebrew Cask:
  brew cask install ngrok

Ngrokをインストールする。

$ brew cask install ngrok
==> Satisfying dependencies
==> Downloading https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-darwin-amd64.zip
######################################################################## 100.0%
==> No SHA-256 checksum defined for Cask 'ngrok', skipping verification.
==> Installing Cask ngrok
==> Linking Binary 'ngrok' to '/usr/local/bin/ngrok'.
🍺  ngrok was successfully installed!

Ngrokを起動してみる

# バージョン確認しておく。
$ ngrok -v
ngrok version 2.2.8

# ポートを8080にしたApachさんを起動しておく。
$ apachectl start

# 起動してみる。終了するときは「Ctrl + C」
$ ngrok http 8080
ngrok by @inconshreveable                                                                                                                                               (Ctrl+C to quit)

Session Status                online                                                                                                                                                    
Session Expires               7 hours, 58 minutes                                                                                                                                       
Version                       2.2.8                                                                                                                                                     
Region                        United States (us)                                                                                                                                        
Web Interface                 http://127.0.0.1:4040                                                                                                                                     
Forwarding                    http://00dcb63d.ngrok.io -> localhost:8080                                                                                                                
Forwarding                    https://00dcb63d.ngrok.io -> localhost:8080                                                                                                               

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

# この時点でブラウザで「https://00dcb63d.ngrok.io」にアクセスすると「http://localhost:8080/」にアクセスしたときと同じページが表示される。

HTTP Requests                                                                                                                                                                           
-------------                                                                                                                                                                           

GET /favicon.ico                                                                                                                                                                        
GET /favicon.ico                                                                                                                                                                        
GET /                          200 OK                                                                                                                                                   
GET /favicon.ico                                                                                                                                                                        
GET /favicon.ico                                                                                                                                                                        
GET /                          200 OK                                                                                                                                                   
GET /favicon.ico                                                                                                                                                                        
GET /favicon.ico                                                                                                                                                                        
GET /                          200 OK     

# 使い終わったらApacheさんは止める。
$ apachectl stop
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2