LoginSignup
3
3

More than 3 years have passed since last update.

ローカル環境のアプリを一時的に手軽に公開できる ngrok / localhost.run

Last updated at Posted at 2020-08-29

Slackと連携したサーバレスアプリを作りたかったりする場合や、ローカルのDockerで作ったアプリをチームのメンバに見てほしい時など、ローカルアプリを都度都度GCPやAWSに上げると効率が悪い時がある。

以下のサービスを使うと、開発効率が上がるときがある。

  • ngrok
  • localhost.run

serveroがちょっと前に流行ってたみたいだけど、今は利用できなくなっている。

ngrok

公式ページ

使い方は簡単で、

公式ページにログインして、
OSに応じたバイナリファイルをダウンロードして、
以下のコマンドを実行するだけでフォワーディングできる。

# 認証
./ngrok authtoken {ページに記載のトークン}

# 8080は自分のローカルで起動しているアプリケーションのポート番号
./ngrok http 8080


ngrok by @inconshreveable                                                                               (Ctrl+C to quit)                                                                                                                        Session Status                online
Account                       xxxxx@gmail.com (Plan: Free)
Version                       2.3.35
Region                        United States (us)
Web Interface                 http://127.0.0.1:4040
Forwarding                    http://xxxxxxxxxxxxx.ngrok.io -> http://localhost:8080
Forwarding                    https://xxxxxxxxxxngrok.io -> http://localhost:8080

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

localhost.run

公式ページ

もっと簡単。ログインする必要もない。セキュリティは不安だが、
コマンド一つ。

# 8080はローカルアプリのポート番号
ssh -R 80:localhost:8080 ssh.localhost.run

Connect to http://xxxxxxxx-xxxxxxxx.localhost.run
{"domain": "xxxxxxxx-xxxxxxxx.localhost.run", "listen_port": 80, "status": "success", "message": "Connect to http://xxxxxxxx-xxxxxxxx.localhost.run"}
3
3
1

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
3
3