Skip to content

How to setup a CDN under Gitlab Organization

How to setup a CDN under Gitlab Organization

Hello my name is Luiz i'm a software engineer based in brazil, in this article i'll show you how to setup a static files CDN under Gitlab Organization using Gitlab Pages.

What is Gitlab Pages?

Gitlab Pages is a feature that allows you to host static websites directly from your Gitlab repositories. It’s similar to Github Pages, but with a few key differences:

  • Gitlab Pages supports HTTPS for custom domains with Let’s Encrypt, while Github Pages only supports HTTPS for github.io subdomains.
  • Gitlab Pages supports custom domains for private repositories, while Github Pages only supports custom domains for public repositories.

How to setup a CDN under Gitlab Organization

First of all you need to create a Gitlab Organization, if you don't have one yet, you can create one here.

After that you need to create a new project, you can do that here.

Now you need to create a new project with a setup and structure like this:

├── .gitlab-ci.yml
├── public/
   └── Here you put your static files like images, css, js, etc... to be served by the CDN
└── README.md

After that you need to create a new file called .gitlab-ci.yml and put this code inside:

image: alpine:latest

pages:
  stage: deploy
  script:
    - echo "Nothing to do..."
  artifacts:
    paths:
      - public
  only:
    - main

This file will tell Gitlab to deploy the public folder to Gitlab Pages.

Now you need to go to your project settings and enable Gitlab Pages, you can do that here. And make pages available to everyone.

How to use the CDN

As i told before this CDN is using the Gitlab Pages, so in order to access the project you need to go to https://YOUR_ORGANIZATION_NAME.gitlab.io/YOUR_PROJECT_NAME/.

How to use a custom domain

In order to use a custom domain you need to go to your project settings and add your custom domain, you can do that here.

After that you need to go to your domain provider and add a new CNAME record pointing to YOUR_ORGANIZATION_NAME.gitlab.io.

Profile picture
Luiz Fernando - Senior Software Engineer

Thanks for reading!

I hope you enjoyed reading this article. If you have any questions or feedback, don't hesitate to reach out to me on my social media bellow. Have a great day!

Carousel imageCarousel imageCarousel imageCarousel imageCarousel image
Next / Something good starts with a conversation

Big ideas.
Little Luiz.

A product to bring to life? A team to make stronger? Let’s find out what we can build together.

Pick your path
01Freelance / Products

I have a project

Freelance collaborations, products, and technical challenges.

  • From product discovery to delivery
  • Web, mobile, and backend engineering
  • Clear scope. Direct collaboration.
Let’s build something
02Hiring / Teams

I’m building a team

Engineering roles and long-term opportunities.

  • Senior full-stack engineering
  • Product thinking and technical ownership
  • Experience with distributed teams
Hire me for your team
03Résumé / Versions

Explore résumés

Tailored versions for general engineering, health-tech, fintech, and more.

  • Six focused variants
  • Print-ready PDF export
  • Updated for every role
Read my résumé
luizepauloxd@gmail.com

Prefer email? Write directly, or start a draft here.

Tell me what you have in mind.

© 2026 Luiz Fernando Made with intention. And a little curiosity.Back to top