Static Web Server — Static content delivery with speed and reliability

3 min read Original article ↗

Deliver static websites confidently with a modern and Open Source web server designed for secure, efficient, and reliable deployments across platforms.

~/site — static-web-server
$ static-web-server --port=8080 --root=./public --log=info
{"timestamp":"2026-06-12T11:38:03.543447Z","level":"INFO","message":"starting Static Web Server","name":"static-web-server","version":"2.43.0","target":"static_web_server::server"}
{"timestamp":"2026-06-12T11:38:03.544833Z","level":"INFO","message":"log level","log_level":"info","target":"static_web_server::server"}
{"timestamp":"2026-06-12T11:38:03.545077Z","level":"INFO","message":"server bound to tcp socket","addr":"[::]:8787","target":"static_web_server::server::listener"}

Why Static Web Server

Designed to deliver static content easily

A handful of reasons teams pick SWS to ship sites and web assets in production.

High performance

Built with Rust for efficient Async I/O and excellent performance.

Safe by default

Memory-safe, opinionated server defaults, TLS, security headers, Basic Auth and more.

Lightweight & portable

Single ~4MB static binary, no runtime dependencies. Drops into any distro or Docker container.

Easy to set up

CLI flags, environment variables or a TOML file. Sensible defaults with no boilerplate.

Features

Batteries included, zero clutter

A curated set of features for modern static hosting to opt in when you need them.

HTTP/2 & TLS

Modern protocols with HTTPS redirects out of the box.

Smart compression

On-demand gzip, brotli and zstd support.

Pre-compressed files

Serve .gz, .br and .zst straight from disk.

Cache-Control & ETag

Tune browser caching for assets and HTML.

CORS & preflight

Configure origins, methods & headers with full preflight.

Basic Auth

Protect a directory in a single line of configuration.

Security headers

Sensible defaults you can opt into for production.

SPA fallback

Serve index.html on 404 for React, Vue, Svelte.

Rewrites & Redirects

Glob patterns with replacements for clean URLs.

Health & Metrics

Health endpoint and Prometheus metrics built in.

Virtual hosts

Serve multiple sites from one process via host routing.

Directory listing

Optional listing with sorting and JSON output.

Custom HTTP Headers

Set custom headers for client responses on demand.

Markdown Content

Serve Markdown or HTML based on the client's Accept header.

First-class Docker support

Docker images for a variety of platforms and architectures.

Maintenance Mode

Display a custom page for users while performing updates.

Windows Service

Run natively as a managed Windows Service.

New

In-memory caching

Cache frequently accessed files in memory for faster response times.

New

FIPS-validated crypto

Optional FIPS 140 builds for regulated workloads.

New

Unix Domain Sockets

Listen on a UDS for fast, secure local proxying.

See more features →

Configuration

One file. Production-ready.

Describe the whole server configuration in one readable TOML or skip it and pass directly a few flags or environment variables.

  • CLI args, environment variables, or TOML. Pick what fits.
  • One option each per feature set.
  • Zero-config quickstart, point it at a folder and go.

See all options →

sws.toml
[general]
# Bind & serve
host = "0.0.0.0"
port = 80
root = "./public"

# Performance
compression           = true
cache-control-headers = true
http2                 = true

# Security
security-headers = true
basic-auth       = "user:hashed-pass"

# SPA support
page-fallback = "./public/index.html"

Runs anywhere

Pre-built for every platform you ship to

Native binaries and Docker images for desktops, servers, mobile and the web.

  • Linux
  • macOS
  • Windows
  • FreeBSD
  • NetBSD
  • Android
  • Docker
  • WebAssembly

Pre-compiled binaries for x86, x86_64, ARM and ARM64. Docker images on scratch, Alpine and Debian.

Get started

Up and running in under a minute

Install with one command in Linux/BSD, then point it at any folder of static files.

curl --proto '=https' --tlsv1.2 -sSfL https://get.static-web-server.net | sh

If you use Docker, then try

docker run -p 8080:80 -v $PWD:/public ghcr.io/static-web-server/static-web-server:3