本文へスキップ

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 - シニアソフトウェアエンジニア

読んでくれてありがとう!

この記事を楽しんで読んでいただければ幸いです。ご質問やご意見がございましたら、下記のソーシャル メディアからお気軽にご連絡ください。良い一日をお過ごしください。

Carousel imageCarousel imageCarousel imageCarousel imageCarousel image
次へ / 良い会話から始めましょう

大きなアイデア。
Little Luiz.

実現したいプロダクト、強くしたいチーム。一緒に何ができるか、話してみませんか。

道を選ぶ
01Freelance / Products

プロジェクトの相談

フリーランスでの協業、プロダクト開発、技術的な課題。

  • プロダクトの発見からリリースまで
  • ウェブ、モバイル、バックエンド開発
  • 明確なスコープと直接の協業
一緒につくりましょう
02Hiring / Teams

チームへの採用

エンジニアの採用と長期的な機会。

  • シニアフルスタックエンジニアリング
  • プロダクトの視点と技術的な責任
  • 分散チームでの経験
チームへの採用相談
03Résumé / Versions

履歴書を見る

汎用エンジニアリング、ヘルステック、フィンテックなど、用途別のバージョン。

  • 6つの特化バージョン
  • 印刷用PDFエクスポート
  • 役割ごとに更新
履歴書を見る
luizepauloxd@gmail.com

メールをご希望ですか?直接送るか、こちらで下書きを作成できます。

考えていることを教えてください。

© 2026 Luiz Fernando 意図と、少しの好奇心を込めて。ページの先頭へ