LoginSignup
34
32

More than 3 years have passed since last update.

【無料】Cloudflareを使ってHerokuで独自ドメインで運用する方法

Last updated at Posted at 2019-07-31

Railsアプリケーションのproduction.rbの設定を変更

config/environments/production.rb
config.force_ssl = true

ドメインを登録する

image.png

Freeプランを選択

image.png

初期で入ってるのはすべて消す

image.png

CNAME-独自ドメイン-Herokuドメイン で設定する

image.png

ネームサーバーの設定変更

変更する情報はCLOUFAREのDNSの下部にある

image.png

お名前ドットコムでネームサーバーを変更する

image.png

Herokuにてドメインの追加

ドメインを追加するためにはクレジットカードの登録が必要なので、先に登録しておきます。

Personal>'appName'>Setting>Domains and cerfificates でドメインを入力

image.png

image.png

CloudFlareでSSL対応設定

image.png

リダイレクトも設定できる

image.png

以上!

【追記】ドメインを無料で取得する方法

ドメインを無料で取得する方法があるのをご存じでしょうか。
「お名前ドットコム」に登録してメールマガジンを取得していると定期的に下のようなメールが届きます。
image.png

.workなどのドメインであれば本当に無料で取得できてしまいます。
メール内のリンクからドメインを取得すれば1年間はタダで利用できます。
私も実際に5個以上は無料取得しましたよ。

image.png

ぜひ利用してみてください!

34
32
5

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
34
32