0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

GitHub Pagesにカスタムサブドメインを割り当てる

Last updated at Posted at 2021-10-20

ついに自分のドメインを取得した(以下の記事参照)ので、GitHubPagesで公開していたプロジェクトにカスタムドメインを割り当ててみようと思います。

①GitHub Pagesにカスタムサブドメインを入力

対象リポジトリの「Settings→Pages」からCustom domainにカスタムサブドメインを入力し、「Save」押下

image.png

②Route53でCNAMEレコードを追加

以下のレコードをホストゾーンに追加

  • レコード名:*
  • レコードタイプ:CNAME
  • 値:.github.io

image.png

(2025/04/14 修正)
※ワイルドカードを指定することを強く推奨と参考ページに書いてあったので、レコード名はワイルドカードを指定します
ワイルドカードは推奨されてないため、正式運用する場合はちゃんとサブドメインをしていしましょう

image.png

引用:https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site#configuring-a-subdomain

③GitHub側でチェック

「Check again」を押下します。

image.png

TLSの設定を自動でやってくれるので、しばらく待ちます。(15分くらいかかるかもとのことです)

image.png

※HTTPSを強制するために、「Enforce HTTPS」にチェック入れましょう

アクセスする

無事に指定したカスタムドメインで公開することができました!!!

image.png

※GitHub Pagesのデフォルトドメイン(.github.io/)で公開していたプロジェクトをカスタムドメインに変更する場合、base href/<repo>から/に変更する必要があるので注意が必要です。

※今回試したURLはまだ開発中のシステムなので、使えません。。

参考

0
2
2

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
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?