Gitlab Pages Custom Domain Setup
Mistryious.com is built using Hugo and is hosted on Gitlab Pages. It uses Gitlab CI for pushing new content and changes to the site.
In this post, I share how custom domains can be setup for personal projects in Gitlab.
The guidance on Gitlab for this setup is a little outdated hence it took me some time to set it up with my domain provider.
- Register on Gitlab.
- Create a new project repository.
- Access the project ‘Pages’ from Settings menu.
- Your Gitlab Pages project should be served under
http(s)://username.gitlab.io/projectname
. - Log on to your custom domain provider DNS settings and add the records as below.
Type | Host | Value | TTL |
---|---|---|---|
A Record | @ | 104.208.235.32 | Automatic |
A Record | www | 104.208.235.32 | Automatic |
CNAME Record | yourcustomdomain.com |
username.gitlab.io |
Automatic |
URL Redirect Record (optional) | @ | https://yourcustomdomain.com |
After a few minutes, your custom domain should now point to http(s)://username.gitlab.io/projectname
. Let me know how it goes. If there are any questions or comments, please leave them below and I’ll be happy to respond.
In the next post, I will cover how to enable free HTTPS/TLS for your custom domain using LetsEncrypt on Gitlab Pages.