Static Web Server
A cross-platform, high-performance & asynchronous web server for static files serving
v1.x End of Life (2023-01-06)
v1.19.4 was the last version of the 1.x series and will be no longer supported.
So we encourage users to migrate to v2 which has similar and additional features as well as significant performance and security improvements. Follow the v2 migration steps.
Static Web Server (or
SWS abbreviated) is a tiny and fast production-ready web server suitable to serve static web files or assets.
It is focused on lightness and easy-to-use principles while keeping high performance and safety powered by The Rust Programming Language.
Written on top of Hyper and Tokio runtime, it provides concurrent and asynchronous networking abilities and the latest HTTP/1 - HTTP/2 implementations.
It's cross-platform and available for
- Built with Rust, which focuses on safety, speed and concurrency.
- Memory-safe and significantly reduced CPU and RAM overhead.
- Blazing fast static files-serving and asynchronous powered by the latest Hyper, Tokio and a set of awesome crates.
- Single 4MB (uncompressed) and fully static binary with no dependencies (Musl libc). Suitable for running on any Linux distro or Docker container.
- Optional GZip, Deflate, Brotli or Zstandard (zstd) compression for text-based web files only.
- Compression on-demand via Accept-Encoding header.
- Partial Content Delivery support for byte-serving of large files.
- Optional Cache-Control headers for assets.
- Termination signal handling with graceful shutdown ability and grace period.
- HTTP/2 and TLS support.
- Security headers for HTTP/2 by default.
- HEAD responses.
- Lightweight and configurable logging via tracing crate.
- A Customizable number of worker threads.
- Optional directory listing.
- CORS support.
- Basic HTTP Authentication.
- Customizable HTTP response headers for specific file requests via glob patterns.
- Fallback pages for 404 errors, useful for Single-page applications.
- Run the server as a Windows Service.
- Configurable using CLI arguments, environment variables or a TOML file.
- Default and custom error pages.
- Custom URL rewrites and redirects via glob patterns.
- Support for serving pre-compressed (Gzip/Brotli) files.
- First-class Docker support. Scratch and latest Alpine Linux Docker images.
- Ability to accept a socket listener as a file descriptor for sandboxing and on-demand applications (e.g systemd).
- Cross-platform. Pre-compiled binaries for Linux, macOS, Windows and FreeBSD (
For more details see benchmarks repository