LoginSignup
5
6

More than 5 years have passed since last update.

Herokuで作ったアプリにルートドメインを設定する

Last updated at Posted at 2016-05-22

背景

  • 某VPSで動かしているアプリケーションにルートドメイン(example-domain.comみたいなやつ)を設定していた。それをHerokuに移行しようとしたときにちょっと困った話
  • CNAMEにしとけばよかった。
  • やり方は下記に書いてある。
  • 日本語だと下記にまとまっている。
  • 私もPoitDNSというAdd-onを使ってAliasを使ったらできた。
  • AレコードはIPアドレスと紐付いているのでHerokuみたいにIPアドレスが変わるやつだとよろしくない。なのでAliasを使う、と。

PointDNSをつかう

Add-onを有効にする

$ heroku addons:create pointdns:developer
Creating pointdns-xxxxx-xxxxx... done, (free)
Adding pointdns-xxxxx-xxxxx to xxxx-xxxx-xxxx... done
Use `heroku addons:docs pointdns` to view documentation.

アプリ側にドメインを設定する。よく忘れるので注意。

$ heroku domains:add example-domain.com
Adding example-domain.com to ⬢ xxxx-xxxx-xxxx... done
 ▸    Configure your app's DNS provider to point to the DNS Target xxxx-xxxx-xxxx.herokuapp.com.
 ▸    For help, see https://devcenter.heroku.com/articles/custom-domains

あとはドメイン登録事業者の管理ページで対象ドメインのネームサーバーを登録すればOK。
私はお名前ドットコムを使っているのですが、UIがわかりにくくて大変だった。

5
6
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
5
6