Static Web Server
Cross-platform, high-performance, and asynchronous web server for static file serving.
Alternatives
Tech stack
No tech stack added yet. Sign in to suggest some
Note: The official website content could not be retrieved this time. The description below is compiled from what is known about the project. Please refer to the official documentation for version details and specific parameters.
Introduction
Static Web Server (SWS for short) is an open-source static file web server written in Rust, built on top of Hyper and the Tokio async runtime. It aims to be small, fast, and ready to use out of the box. It ships as a single, very small executable with no other dependencies, making it well suited to hosting static websites, front-end build output, and single-page applications (SPAs).
Key Features
- High-performance async serving: Built on Rust's async ecosystem, with low memory usage and strong concurrency.
- HTTP/2 and TLS: Supports HTTPS and HTTP/2.
- Content compression: Supports compression methods such as Gzip and Brotli, and can also serve precompressed files directly.
- Single-page app support: Lets you set a fallback page to support front-end routing.
- Directory listing: Directory browsing can be enabled optionally.
- Security and access control: Supports CORS, Basic authentication, and security-related response headers.
- Cache control: Lets you set Cache-Control response headers for static assets.
- Custom rules: Lets you define custom response headers, redirects, and rewrite rules, as well as custom error pages.
- Flexible configuration: Can be configured through command-line arguments, environment variables, or a TOML configuration file.
- Graceful shutdown: Shuts the service down cleanly when it receives a termination signal, which suits container orchestration environments.
Target Users and Use Cases
- Developers who need to quickly host a static website or documentation site
- Operations engineers who deploy front-end applications on Docker or Kubernetes and want a slim image
- Users who want a lighter-weight alternative to Nginx or Apache for serving static files
- Situations where you need to spin up a file server locally for previewing and debugging
Core Advantages
- A single executable with no external dependencies, so deployment is simple
- Low resource usage, suitable for embedded and edge devices
- Cross-platform, supporting Linux, macOS, Windows, and other systems, as well as multiple CPU architectures
- Official Docker images are provided, making containerized deployment easy
Installation and Deployment
Docker:
docker run --rm -p 8787:80 -v $(pwd)/public:/public joseluisq/static-web-server:2
Binary: Download the prebuilt file for your platform from the project's GitHub Releases page, then run it directly:
static-web-server --port 8787 --root ./public
For more installation methods (such as package managers on various platforms) and the full list of configuration options, see the official documentation.
Technical Requirements
- No additional runtime environment is needed to run the prebuilt binary
- Building from source requires the Rust toolchain
Notable Points
- Open source under a dual MIT / Apache-2.0 license
- It only serves static files and cannot execute dynamic scripts (such as PHP); if you need dynamic content, you must pair it with another backend service
Discover more
Apache HTTP Server
Secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.
Caddy
Powerful, enterprise-ready, open source web server with automatic HTTPS.
go-doxy
Lightweight, simple, and performant reverse proxy with WebUI, Docker integration, automatic shutdown/startup for container based on traffic.
Algernon
Small self-contained pure-Go web server with Lua, Markdown, HTTP/2, QUIC, Redis and PostgreSQL support.
Atomic Server
Knowledge graph database with documents (similar to Notion), tables, search, and a powerful linked data API. Lightweight, very fast and no runtime dependencies.
Bencher
Suite of continuous benchmarking tools designed to catch performance regressions in CI.