LoginSignup
17
14

More than 5 years have passed since last update.

Mac上にngrokをインストール

Last updated at Posted at 2016-06-18

ngrok を使って気軽に手元のサーバを外部に公開する方法です

ngrok とは

ngrok
https://ngrok.com/

自分の手元の環境をそのまま外部からアクセスできるようにするためのツールです。

公開用サーバを立てるのがめんどくさいときなどに便利です。

インストール (Mac + homebrew)

$ brew update
$ brew install homebrew/binary/ngrok2

起動

80番ポートを外部に公開する

$ ngrok http 80

アクセスする

$ curl http://[ランダムな文字列].ngrok.io

ユーザー登録

Github, Twitter で認証可能

$ ngrok authtoken [サイト上で発行された文字列]
Authtoken saved to configuration file: /Users/[ユーザー]/.ngrok2/ngrok.yml

サブドメイン名を指定して利用

有償プランのみ可能 ($5/month~)
https://dashboard.ngrok.com/billing/plan

$ ngrok http 80 --subdomain=hogehogehoge
$ curl hogehogehoge.ngrok.io

ビジネスプランに入るとIPアドレスのホワイトリスト設定ができます。

17
14
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
17
14