【Mac】ローカルホストに、一時的に外部からアクセス出来るようにする


ngrokアカウント作成

Setup&Installation

ngrokをダウンロード

1. Unzip to install

ダブルクリックで解凍してから、二本指クリック(control+クリック)から「開く」を選択
or

Macターミナル
unzip /path/to/ngrok.zip

2. Connect your account

アカウントに接続

Macターミナル
./ngrok authtoken {Your Authtoken}

AuthenticationタブのYour Authtokenでも確認出来る

3. Fire it up

ローカルに外部から接続出来るhttpとhttpsのURLを発行

Macターミナル
# Dockerとかで80番ポートを使用している場合(http://localhostに繋ぎたい場合)
./ngrok http 80

# MAMPで8888番ポートを使用してる場合(http://localhost:8888に繋ぎたい場合)
./ngrok http 8888
結果
Forwarding    http://xxxxxxxxxxxx.ngrok.io -> http://localhost:80                        
Forwarding    https://xxxxxxxxxxxx.ngrok.io -> http://localhost:80                   

http://xxxxxxxxxxxx.ngrok.io
or
https://xxxxxxxxxxxx.ngrok.io
にアクセスするとローカルホストに接続される