LoginSignup
6

More than 3 years have passed since last update.

ngrokをubuntu16.04上にインストール

Last updated at Posted at 2017-08-24

参考 
how to install ngrok in linux/ubuntu - YouTube
Mac上にngrokをインストール - Qiita

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

ngrok とは

ngrok
https://ngrok.com/

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

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

インストール (ngrok公式サイトのやり方ではunzipできない。)

https://ngrok.com/download へ行き、

Step 1: Download ngrok
Mac OS X 64-Bit Download
Windows 64-Bit Download
Linux 64-Bit Download
Linux ARM Download
FreeBSD 64-Bit Download

というボタンがあるのでlinux 64-bitのdownloadボタンをクリックしてダウンロードして好きな場所に解凍。

$ ngrokのあるフォルダに移動。
$ sudo cp ngrok /usr/bin/

終了

起動

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アドレスのホワイトリスト設定ができます。

mac編

ngrokコマンドが使えないときは、
usr/local/binに、ngrokアプリが存在しない時。
そのため、
sudo mv ngrok usr/local/bin
とすると、ngrokコマンドが使えるようになる。

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
6