Step-by-Step Guide to Publishing GitLab Pages at a IONOS Domain Provider
Adding a custom domain to GitLab Pages involves two main steps:
-
Adding the Custom Domain in GitLab.
-
Verifying the Domain Ownership.
Let me walk you through the process in detail.
Step 1: Adding a Custom Domain to GitLab Pages¶
-
Go to Your Project in GitLab:
- Navigate to your project where GitLab Pages is set up.
-
Access Pages Settings:
- Go to Settings > Pages in the left-hand menu.
-
Add a New Domain:
- Under the Domains section, click New Domain.
- Enter your custom domain (e.g.,
gridlab.io
ordocs.gridlab.io
). - Click Create New Domain.
Step 2: Verifying Domain Ownership¶
GitLab may require you to verify domain ownership to ensure you have control over the domain. Here’s how to do it:
-
Verification Method:
- GitLab provides a TXT record for domain verification.
- After adding the custom domain in GitLab, you’ll see a TXT record under the domain details in the Pages settings.
-
Add the TXT Record:
- Go to your IONOS DNS provider and add the TXT record provided by GitLab.
- For example:
- Name: _gitlab-pages-verification-gridlab.io
- Value: gitlab-pages-verification-code=
-
Wait for DNS Propagation:
- DNS changes can take a few minutes to several hours to propagate..
-
Wait for DNS Propagation:
- Once the TXT record is propagated, GitLab will automatically verify the domain.
- You’ll see a green checkmark next to the domain in the Pages settings indicating successful verification.
Step 3: SSL/TLS Configuration¶
-
Automatic SSL:
- GitLab Pages automatically provisions SSL certificates for your custom domain via Let’s Encrypt.
- Ensure that your DNS records are correctly set up before enabling SSL.
By following these steps, you can successfully add a custom domain to your GitLab Pages and verify domain ownership.
Step 4: Set up DNS records¶
Login into your IONOS account and select the domain you want to use for your Githu
Then go to your domain DNS configuration panel:
-
Delete all existing DNS records:
- You need to delete all existing
A
andAAAA
records for the@
host and replace them with the IP addresses for GitLab PagesA
records.
- You need to delete all existing
After they are all deleted, you need to click on Add registry to create the new A records pointing to the GitLab Pages IPs.
-
Add GitLab Pages DNS record:
- Type: A
- Hostname: @
- Points to: 35.185.44.232
- TTL: 1 hour (default value)
- Add a DNS registry for www: disabled
Info
It’s VERY important that Add a DNS registry for www option is disabled
After creating the new DNS record for GitLab Pages IP address we have to add redirection. This time a CNAME
record pointing to your <GITLAB_USERNAME>.github.io.
-
Add GitLab Pages DNS record:
- Type: CNAME
- Hostname: www
- Points to:
.github.io. - TTL: 1 hour (default value)
-
Wait for DNS Propagation
And that’s all.