LoginSignup
4
1

More than 1 year has passed since last update.

ngrok使ってローカル環境をサクッと外部公開する

Last updated at Posted at 2022-01-21

ngrok

Wordpressローカル環境をLocal By Flywheelで構築したでLive Linksが便利だったのでngrok使ってみた

Live Links同様、ローカル環境を外部からアクセスできるようになります!!

手順

  1. 公式でFreeプランでアカウントを登録する
    • Basic認証を使用しない場合はアカウント登録しなくてもOK)
    • サブドメイン指定は有料プランにする必要あり
  2. DLぺージからDL方法を選択する.

    macの場合

    $ brew install ngrok/ngrok/ngrok
    $ ngrok -v
    ngrok version 2.3.40
    
  3. Your Authtokenページで確認できるトークンを登録する

    $ ./ngrok authtoken <トークン>
    

    ※トークンは~/.ngrok2/ngrok.ymlに記録されます

  4. webサーバーを起動する

    • authオプションでBasic認証のID/PWを設定する
    • regionオプションで日本リージョンを指定
$ ngrok http -region jp -auth="user-name:user-pass" 8080
ngrok by @inconshreveable                                                                                                 (Ctrl+C to quit)

Session Status                online                                                                                                      
Account                       dtakeuchi (Plan: Free)                                                                                      
Version                       2.3.40                                                                                                      
Region                        Japan (jp)                                                                                                  
Web Interface                 http://127.0.0.1:4040                                                                                       
Forwarding                    http://ffbe-118-238-205-180.jp.ngrok.io -> http://localhost:8080                                            
Forwarding                    https://ffbe-118-238-205-180.jp.ngrok.io -> http://localhost:8080                                           

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

Web Interface

コンソールでもリクエストは確認できますが、Web Interface( http://localhost:4040 )も用意されています

スクリーンショット 2022-01-20 14.48.02.png

4
1
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
4
1