Overview
[!NOTE] This is the upcoming v3, currently in development. For production use, see v2 (LTS).
Static Web Server (SWS) is a small, fast, production-ready web server for static file-serving that prioritizes simplicity and ease of use while delivering high performance and safety, powered by Rust. Built on Hyper and Tokio to deliver efficient and performant asynchronous I/O and HTTP/1-2 support with a low resource footprint.
SWS is available for a variety of platforms like Linux, macOS, Windows, FreeBSD, NetBSD, Android and Docker.
Features
- Built with Rust, memory-safe, fast, and concurrent with low CPU and RAM overhead.
- Single ~4 MB static binary with zero runtime dependencies (Musl libc). Runs on any Linux distro or Docker container.
- Fast, asynchronous static file-serving built on Hyper and Tokio.
- On-the-fly compression (Gzip, Deflate, Brotli, Zstandard) for text-based files via
Accept-Encoding. - Serving of pre-compressed files (
.br,.gz,.zst) directly from disk. - Markdown content negotiation to serve
.mdfiles to clients that accepttext/markdown. - Byte-range serving for large file delivery.
- Optional Cache-Control headers and ETag with sensible defaults per file type.
- HTTP/2 + TLS with automatic security headers.
- Graceful shutdown with configurable grace period.
- Structured JSON logging (
--log-format) and file-based log output (--log-file). - Configurable thread pool (worker and blocking threads).
- Optional directory listing with HTML and JSON output, plus
.tar.gzdownload. - CORS with preflight support.
- Basic HTTP authentication (BCrypt).
- Custom response headers per file via glob patterns.
- URL rewrites and redirects with placeholder replacement.
- Virtual hosting with per-host root directories.
- Fallback page for 404 errors (SPA support).
- Custom error pages.
- Built-in HTTP to HTTPS redirect.
- Health check endpoint (GET/HEAD).
- Prometheus metrics endpoint with request counts, latency histograms, and connection tracking.
- Maintenance mode with configurable status.
- Configuration via CLI arguments, environment variables, or a TOML file.
- Windows Service support.
- Socket activation (systemd) for sandboxed and on-demand deployments.
- Available as a Rust library with opt-in features.
- First-class Docker images: Scratch, Alpine Linux, and Debian.
- Cross-platform pre-compiled binaries for
Linux,macOS,Windows,FreeBSD,NetBSD,Android(x86_64,ARM64).
Documentation
Please refer to The Documentation Website for more details about the API, usage and examples.
Releases
Contributions
Unless you explicitly state otherwise, any contribution you intentionally submitted for inclusion in current work, as defined in the Apache-2.0 license, shall be dual licensed as described below, without any additional terms or conditions.
Feel free to submit a pull request or file an issue.
Community
License
This work is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).
© 2019-present Jose Quintana