</> HTML5Advent
ENFRESDEITPT

// hosting · Web Platform Advent #12

Static website hosting: how to deploy an Astro, Vite or plain HTML site

What static hosting is, how a CDN serves your build, and how to deploy an Astro, Vite or JAMstack site with a custom domain and free HTTPS.

A technician's hand servicing a blue-lit server in a data center rack

A static website is a set of pre-built files — HTML, CSS, JavaScript and assets — that a server can hand to the browser as-is, with no code running per request. Tools like Astro, Vite, Eleventy or a hand-written HTML folder all produce this kind of output. Hosting it is simpler, cheaper and faster than hosting a dynamic app, because there is nothing to execute server-side.

What "static hosting" actually means

With static hosting, you run a build step locally or in CI, and it emits a folder of plain files (often called dist or _site). The host's only job is to store those files and serve them over HTTP. There is no PHP, no Node process, no database — just files. That has three direct consequences:

  • Speed — files can be cached aggressively and served from the edge, close to the visitor.
  • Cost — no always-on server to pay for; many providers offer a generous free tier.
  • Reliability — fewer moving parts means fewer things that can break under load.

Building your output folder

Every static framework exposes a build command. The result is the folder you upload or point your host at:

# Astro
npm run build        # outputs to ./dist

# Vite
npm run build        # outputs to ./dist

# Plain HTML
# no build step — your folder of .html files is already the output

For a plain HTML site, the "build" is just the folder you already have. For Astro or Vite, the dist directory is what gets served.

A row of black rack-mounted servers in a data center
Behind every static site is physical infrastructure — racks of servers and CDN edge nodes that store and distribute your built files.

Where to host: CDN vs. classic static hosting

You have two broad families of options:

Edge / CDN platforms

These build your project from a Git repository and distribute the output across a content delivery network. A CDN stores copies of your files in many locations worldwide, so a visitor is served from a node near them. This minimizes latency and absorbs traffic spikes. Deploys are usually triggered by a git push.

Classic / object-storage hosting

You can also serve a static site from a traditional web host or from object storage with a CDN in front of it. This is a good fit when you already have hosting for other projects, or when you prefer to manage the upload yourself over FTP/SSH or a deploy script.

Connecting a custom domain

Whichever host you choose, the domain wiring is the same in principle. You point your domain's DNS records at the host:

  • An A (or AAAA) record pointing the apex domain (example.com) to the host's IP, or
  • A CNAME record pointing a subdomain (www.example.com) to the host's provided hostname.

Many platforms also support nameserver delegation, where you hand DNS management to the host entirely. After the records propagate, the host serves your site on your own domain.

HTTPS for free

HTTPS is no longer optional — browsers flag plain HTTP as "not secure", and many web platform APIs only work in a secure context. The good news: virtually every modern static host issues and renews TLS certificates for you automatically, usually via Let's Encrypt. Once your domain is connected, the certificate is provisioned without any manual step, and renewals happen on their own.

Quick reference

StepWhat you do
BuildRun npm run build (Astro/Vite) or use your HTML folder
OutputServe the dist / _site folder
HostPick an edge/CDN platform or a static-capable web host
DomainPoint A/AAAA or CNAME records at the host
HTTPSAutomatic TLS certificate, no manual setup

The whole point of static hosting is that it gets out of your way: you build once, push, and the files are served fast from the edge. Reserve dynamic hosting for the parts of your project that genuinely need server-side logic — and keep the static frontend on infrastructure built to deliver files quickly.