> For the complete documentation index, see [llms.txt](https://owen31302.gitbook.io/github-education/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://owen31302.gitbook.io/github-education/apply-free-name-space-heroku.md).

# name.com免費網域申請

{% hint style="warning" %}
如果你不是很清楚DNS運作方式，推薦Udacity上的課程：[Introduction to Cybersecurity](https://www.udacity.com/course/introduction-to-cybersecurity--ud1337)

Lesson 3 Networking - Domain name system
{% endhint %}

當你使用Github student登入後，就可以免費獲得一個網域，為期一年。

![你可以先看看原始價格](/files/-M2vqdQr4wSQft1Bg_Y_)

![結帳前的最後確認](/files/-M2vrldIi0VucXtlsrHA)

## 將新網域轉址到Heroku

![](/files/-M2vwGPD1XkH8xwpBZcj)

## 在Heroku上顯示你的Custom Domain Name

{% hint style="warning" %}
透過這個討論（[Setting up a custom domain with heroku and namecheap](https://stackoverflow.com/a/25925332/3117474)）發現，只有www開頭的網址才能被Heroku接受成為Root domain，我測試的結果也是如此。但如果你沒有設置SSL Certificates，你的網站不會是secured。如果要有SSL Certificates，必須花$20/month，但這個服務只要升級成paid dynos就會有。如果有這個需求建議升級成paid dynos還比較便宜。
{% endhint %}

![到Heroku取得DNS target](/files/-M2vxZK_znFylt3E28M1)

![到Name.com輸入你的DNS target](/files/-M2yaYwo5JKH5BljbvKV)

等候幾分鐘再測試你的網域，應該就可以看到你的服務以及你的custom網域名，但要注意，如果你需要SSL Certificates，必須付費升級為paid dynos。

## 參考資料

[Custom Domain Names for Apps](https://devcenter.heroku.com/articles/custom-domains)

[Setting Up A Custom Domain For Your Heroku-Hosted App](https://medium.com/@ethanryan/setting-up-a-custom-domain-for-your-heroku-hosted-app-6c011e75aa3d)

[Manually Acquiring an SSL/TLS Certificate](https://devcenter.heroku.com/articles/acquiring-an-ssl-certificate#generate-csr)

[How to install an SSL Certificate on Heroku?](https://www.ssldragon.com/blog/how-to-install-an-ssl-certificate-on-heroku/)

由上面文章發現，如果你的網域要SSL Certificate on heroku，你必須要跟heroku買這個服務，一個月20塊。

[SSL in Heroku with a custom domain](https://stackoverflow.com/a/50737716/3117474)

[Heroku SSL Endpoint](https://gist.github.com/mrrooijen/3354578)

[How to setup SSL on Heroku for a Rails Application](https://www.resumonk.com/blog/setup-ssl-certificate-heroku/)
