Setup Customized Domain of Your Gitlab Page

Knowledge of DNS Record Is the Key

Gitlab page, which is in the default format of *.gitlab.io, is able to host a static page easily. You can use your customized domain name. See the details of this how-to guide. To help yourself understand and follow the how-to guide more smoothly, the knowledge of DNS Record is the key.

In short, your domain provider needs to show the verification text proving that you are the owner of the domain. So you need to know how to get and set the TXT field. You also want to tell which server containing the content of the static page. That said, CNAME should be set as well. In the other words: - TXT for ownership - CNAME for content

The Setup Steps

Gitlab will need the following information: - Proof that you are the domain owner (via TXT DNS record) - Encrypted approach if you want to support https (by default you can use let's encrypted on Gitlab) - If you want to make your page public (yes for sure)

So, assuming my domain provider is Gandi, the example of setup step is: - Go to the page setting of Gitlab. Search for domain name setup (something like "new domain"). Copy the dns record that you will need to fill in the TXT field of DNS record (via Gandi's service) later. - Go to your domain provider a.k.a. Gandi in my case, add the above verification text into your DNS record. For example, go to "domain", "DNS record", "add record", and then select type "TXT" and paste the verification TXT. You may want to make the TTL shorter, so you may get quicker change. You can make TTL longer when everything is done and stable. Finally, setup CNAME. - Go back to the general settings of Gitlab and then visibility to make sure your page is public.

That's it! Once you know how DNS TXT query and CNAME work, this setup should be very straightforward.

Troubleshooting Tips

Additional DNS Lookup Utilities

Reference

If you are not familiar the basic knowledge of DNS. HaWay's tutorial(written in Chinese) is a good starter.