Static Web Server

igoose11 pts0 comments

Static Web Server Skip to content

Initializing search

static-web-server/static-web-server

Getting Started<br>Download and Install<br>Configuration<br>Building from Source<br>Features<br>Platforms & Architectures<br>Migrating from v1 to v2<br>Changelog v2 (stable)<br>Changelog v1 (deprecated)<br>Semantic Versioning<br>Report Security Issues<br>Contributions<br>Showcases<br>License

Static Web Server<br>A cross-platform, high-performance & asynchronous web server for static files serving

Overview&para;<br>Static Web Server (or SWS abbreviated) is a tiny and fast production-ready web server suitable to serve static web files or assets.<br>It is focused on lightness and easy-to-use principles while keeping high performance and safety powered by The Rust Programming Language.<br>Written on top of Hyper and Tokio runtime, it provides concurrent and asynchronous networking abilities and the latest HTTP/1 - HTTP/2 implementations.<br>Cross-platform and available for Linux, macOS, Windows, FreeBSD, NetBSD, Android, Docker and Wasm (via Wasmer).

Features&para;<br>Built with Rust, which focuses on safety, speed and concurrency.<br>Memory-safe and significantly reduced CPU and RAM overhead.<br>Blazing fast static files-serving and asynchronous powered by the latest Hyper, Tokio and a set of awesome crates.<br>Single 4MB (uncompressed) and fully static binary with no dependencies (Musl libc). Suitable for running on any Linux distro or Docker container.<br>Optional GZip, Deflate, Brotli or Zstandard (zstd) compression for text-based web files only.<br>Compression on-demand via Accept-Encoding header.<br>Markdown content negotiation via Accept header for serving .md files.<br>Partial Content Delivery support for byte-serving of large files.<br>Optional Cache-Control headers for assets.<br>Termination signal handling with graceful shutdown ability and grace period.<br>HTTP/2 and TLS support.<br>Security headers for HTTP/2 by default.<br>HEAD and OPTIONS responses.<br>Lightweight and configurable logging via tracing crate.<br>Customizable number of blocking and worker threads.<br>Optional directory listing with sorting and JSON output format support.<br>CORS with preflight requests support.<br>Basic HTTP Authentication.<br>Customizable HTTP response headers for specific file requests via glob patterns.<br>Fallback pages for 404 errors, useful for Single-page applications.<br>Run the server as a Windows Service.<br>Configurable using CLI arguments, environment variables or a TOML file.<br>Default and custom error pages.<br>Built-in HTTP to HTTPS redirect.<br>GET/HEAD Health check endpoint.<br>Prometheus-compatible /metrics endpoint for traffic monitoring.<br>Support for serving pre-compressed (Gzip/Brotli/Zstd) files directly from disk.<br>Custom URL rewrites and redirects via glob patterns with replacements.<br>Virtual hosting support.<br>Multiple index files.<br>Maintenance Mode functionality.<br>Available as a library crate with opt-in features.<br>First-class Docker support. Scratch, latest Alpine Linux and Debian Docker images.<br>Ability to accept a socket listener as a file descriptor for sandboxing and on-demand applications (e.g. systemd).<br>Cross-platform. Pre-compiled binaries for Linux, macOS, Windows, FreeBSD, NetBSD, Android (x86/x86_64, ARM/ARM64) and WebAssembly (via Wasmer).<br>Benchmarks&para;

For more details see the benchmarks repository.<br>For feedback or questions feel free to reach us on the discussions page.<br>Community&para;<br>SWS Community on Discord

Back to top

static server files http support serving

Related Articles