Static website hosting

  • Static websites are ones that are fixed and display the same content for every user, usually written exclusively in HTML
  • Static web pages can contain client-side technologies such as HTML, CSS, and JavaScript.
  • They cannot contain dynamic content such as server-side scripts like PHP.

Most website provide free static-hosting

  • Gitlab Pages, Github Pages
  • Netlify
  • Firebase
  • Amazon S3

What is GitLab Pages?

  • With GitLab Pages, you can publish static websites directly from a repository in GitLab.
  • Use for any personal or business website.
  • Use any Static Site Generator (SSG) or plain HTML.
  • Create websites for your projects, groups, or user account.
  • Host your site on your own GitLab instance or on GitLab.com for free.
  • Connect your custom domains and TLS certificates.

Static Site Generator (SSG)

  1. Fork any SSG
  2. Trigger CI/CD pipeline
    • By making any file changes
    • .gitlab-ci.yml should be present in the repo
  3. Visit Repo’s settings/pages
  4. Congrats, your website is live

Change contents of the website

  • Visit: content folder of repo
    • Make changes as you need
    • CI/CD will trigger on every change
    • On Sucsessful build, all the changes will reflect
  • Visit your SSG page
    • Try to figure how to generate/modify the content
    • Learn any SSG to get comfortable with site-modification
    • You can also change the theme as you like
    • Eg: Hugo, Hugo Theme

Add your custom domain

  • Buy any domain from any domain provider like: namecheap
  • Under your HOST RECORDS

Add records in this way –> For www.example.com

A Record   @   35.185.44.232

# Create a new DNS record  --> kharchapani.club ALIAS amritpra94.gitlab.io.
CNAME Record    kharchapani.club    amritpra94.gitlab.io.

# Verification --> _gitlab-pages-v-c.kp.club TXT gitlab-pages-v-c=2323222332
TXT Record   @   _gitlab-pages-v-c.kp.club TXT gitlab-pages-v-c=2323222332

Add records in this way –> www.subdomain.example.com

A Record   subdomain   35.185.44.232
TXT Record   subdomain   gitlab-pages-veri-code.blog.example.com Tdcd

References