Install
Markdown
Ask AI
Share

Self-Hosted Static Site Hosting: Deploy a Folder With Levelrail

Self-hosted static site hosting from a plain folder: one deploy command, _redirects, _headers and a custom 404 honored, plus a one command rollback.

Markdown
Ask AI
Share

Self-hosted static site hosting with Levelrail is one command: levelrail-cli deploy ./site --static. The folder is uploaded, published and served from the control plane’s own file server, so there is no image to build and no web server to configure. This guide deploys a six file site, checks redirects, headers and the 404 page, deploys a second version and rolls back with one command. The tool is Levelrail, a self-hosted deploy platform. Install it first with the five minute install.

Tested on 2026-11-21 with Levelrail v1.5.7 on a Mac with Docker Desktop and no real domain, so the hostnames are local stand-ins. The commands are the same on a server.

Self-hosted static site hosting: the short version#

StepWhat you doCheckpoint
1Put your files in a folder, with _redirects, _headers and 404.html if you want themSix files
2levelrail-cli deploy ./site --static --app mysitedeploy ...: healthy
3Open the URL and check redirects, headers and the 404 page200, 301 and 404 as expected
4Deploy a second versionThe page changes
5Roll back with apps deploys rollback-toThe first version is back

Step 1: build the site folder#

Six files in site/:

output
404.html
_headers
_redirects
docs/index.html
index.html
style.css

_redirects has one line and _headers adds two headers to every path:

output
/old /docs/ 301
output
/*
  X-Frame-Options: DENY
  X-Tiny-Site: yes

404.html is a page that says “Custom 404 page”. index.html says “Tiny site v1”.

Checkpoint: ls site lists the six files above.

Step 2: deploy it#

Check what would be sent first:

bash
levelrail-cli deploy ./site --static --dry-run
output
deploy: ./site as static site "site", 6 files, 463 B
404.html
_headers
_redirects
docs/index.html
index.html
style.css

Now deploy for real:

bash
levelrail-cli deploy ./site --static --app mysite --yes
output
created app "self-host-static-site-docker" on port 80
  uploaded 551 B as 4c30e822e82583181e303837dc4815b7fd55bf4fc1545ca2caf0855f99cdcad1
  rebuild later with --upload-hash 4c30e822
publishing to the embedded file server
1 rules, 1 header blocks, 0 problems
4 files, 401 bytes, digest sha256:b7434cb2510123575e5b55fcfb5a4c3054fcacc7ee65953ab0624ceda32c8a41
deploy dep_mKo3pKMct2jy: healthy

It finished in about a second. Note 1 rules, 1 header blocks, 0 problems: the control plane parsed the two rule files and applies them at the edge instead of serving them as pages, which is why 6 files became 4. The site needs no container, and apps status reads Ready True StaticSitePublished.

Checkpoint: the last line says healthy and the status reads StaticSitePublished.

Step 3: find the URL and check the rules#

Attach your own name on a real server with levelrail-cli apps domains add mysite example.com, then point DNS at the box. Run levelrail-cli open mysite at any time to print the public URLs. Without a domain, the deploy prints an automatic address for the app. It uses a certificate from the internal CA, so trust that CA on your devices or expect a browser warning.

Put the printed address in a variable and call the site with curl. The -k flag is only for the local CA:

bash
URL="the address the deploy printed"
curl -sk -i "$URL/"
output
HTTP/2 200
cache-control: no-cache
content-type: text/html; charset=utf-8
x-frame-options: DENY
x-tiny-site: yes

The rest of the checks:

RequestResult
/docs/200, text/html
/old301, location: /docs/
/nope404, body is Custom 404 page
/style.css200, carries x-tiny-site: yes

The responses I checked all carried the _headers values. The default cache-control is no-cache. Set your own in _headers for assets with fingerprinted names.

Checkpoint: /old redirects to /docs/, /nope shows your custom page and every response carries x-tiny-site: yes.

Step 4: deploy a second version#

I changed the heading to “Tiny site v2” and ran the same deploy command. The page changed on the next request. The history now lists both releases:

bash
levelrail-cli apps deploys list mysite
output
ID                IMAGE                                                                  DIGEST                     SOURCE  STATUS
dep_nTeTqTZP_VHH  self-host-static-site-docker:44d9da56107e430fc5d3429ff636bc4474191083  ba9925e6872c (StaticTree)  upload  succeeded
dep_TCX752Bc4kn3  self-host-static-site-docker:4c30e822e82583181e303837dc4815b7fd55bf4f  b7434cb25101 (StaticTree)  upload  succeeded

The StaticTree digest is a hash of the published files, so identical content gives the same digest. Copy the id of the release you want to return to. Here that is the first one, dep_TCX752Bc4kn3.

Checkpoint: two rows, both succeeded, and the page says “Tiny site v2”.

Step 5: roll back#

For a static site the rollback command takes the deploy id of the release you want:

bash
levelrail-cli apps deploys rollback-to mysite dep_TCX752Bc4kn3
output
app "self-host-static-site-docker" now targets image "self-host-static-site-docker:pending"; reconcile is asynchronous, follow it with "levelrail-cli deploy status self-host-static-site-docker --watch"

Four seconds later the page said “Tiny site v1” again, apps status read Ready True StaticSitePublished, and the deploy list gained a new row with source manual. Rollback publishes the old tree as a new deploy, so history stays linear and you can roll forward the same way.

Checkpoint: the page shows “Tiny site v1” and the status is still StaticSitePublished.

Read traffic with visitors and access#

levelrail-cli apps visitors mysite gives privacy-safe counts per page, and levelrail-cli apps access mysite lists recent requests with request ids:

output
visitors 1  requests 14  (2xx 12, 3xx 1, 4xx 1, 5xx 0)  window 24h
PAGE        REQUESTS
/           10
/docs/      1
/nope       1
/old        1

A static site has no process of its own, so these two views are where its traffic shows up. They are enough to see which pages people open and which paths return a 404.

Run it on a server#

On a server the flow is the same. Install Levelrail, log in with levelrail-cli, deploy the folder with --static and attach your domain. Keep your site files in git and call the same deploy ./site --static --app mysite command from CI, so every push publishes a new release and every earlier release stays available to rollback-to. Because a static deploy takes about a second and needs no build step, small content fixes go live quickly.

Why this suits small sites#

A static site is only files, so the deploy has very little that can go wrong. There is no runtime to patch, no port to bind and no process to restart. Each release is kept as a published tree, which is why rollback-to can switch back to an older one quickly. Docs, landing pages and project sites fit this model well, and the redirect, header and 404 rules live next to the content in the same folder.

What to take from it#

  • deploy ./site --static is a no-build path, and _redirects, _headers and 404.html all worked.
  • Use apps deploys rollback-to <deploy-id> to roll a static site back to any earlier release.
  • Use visitors and access to read traffic.

FAQ#

Does a static site need a Docker container?#

No. The deploy publishes the files to the control plane’s embedded file server, so there is no image to build and no container to keep running for the site.

Are _redirects and _headers supported?#

Yes. A rule in _redirects returned a 301 and a block in _headers added a response header. A 404.html in the folder became the not-found page.

How do I roll back a static site?#

Run apps deploys rollback-to with the deploy id you want. The old tree is published again as a new deploy, so history stays linear. More in rolling back a failed deploy.

Do I need a build step?#

No. The --static flag publishes the folder as it is. For how traffic stays up during a release, read zero downtime deploys.

Which site will you move onto your own box first? Levelrail is open source under Apache 2.0, and a star on the repo helps other self-hosters find it.

Frequently asked questions#

Does a static site need a Docker container?

No. The deploy publishes the files to the control plane's embedded file server, so there is no image to build and no container to keep running for the site.

Are _redirects and _headers supported?

Yes. A rule in _redirects returned a 301 and a block in _headers added a response header. A 404.html in the folder became the not-found page.

How do I roll back a static site?

Run apps deploys rollback-to with the deploy id you want. The old tree is published again as a new deploy, so history stays linear.

Do I need a build step?

No. The --static flag publishes the folder as it is.

Next steps

Keep reading

A bad release your users never see A bad release your users never see

tutorial 3 min read

Roll Back a Failed Docker Deploy Without Downtime

Ship a broken release on purpose, watch your users stay on the old version, then roll back with one command. Real commands, real output, self-hosted.

  • Docker
  • Deployments
  • Rollback
Zero downtime, with a way back Zero downtime, with a way back

explainer 5 min read

Zero Downtime Deploy for Docker Apps, With Rollback

How a Docker deploy waits for readiness before cutover, holds the previous release for rollback, rolls back on its own, and how to rehearse it.

  • Docker
  • Deployments
  • Rollback