About Static Web Server
Static Web Server, or SWS, is a cross-platform server for static files built in Rust on Hyper and Tokio, dual-licensed MIT and Apache-2.0. It ships as a single static binary of about 4 MB with no runtime dependencies.
A documentation site, a landing page or a compiled single-page app needs nothing more, so SWS sits comfortably on the smallest CloudSat plans.
By default SWS serves ./public on port 80. Every option can be set with a CLI flag, a SERVER_* environment variable or a TOML file (./sws.toml unless SERVER_CONFIG_FILE names another).
What you get with Static Web Server
- On-the-fly Gzip, Deflate, Brotli and Zstandard compression
- HTTP/2 over TLS with automatic security headers
- Fallback page for single-page apps
- Optional directory listing in HTML or JSON
- Basic authentication (bcrypt) and CORS with preflight
Static Web Server use cases
- Serve a built React, Vue or Svelte app
- Host the output of a static site generator
- Share a folder of files with directory listing on
After you deploy Static Web Server
- Once the server is Running, find the root directory in the SWS config (the default is
./public) and upload your files withrsyncorscp. - Load
http://<server IP>/to confirm the pages appear. - For an SPA, set
--page-fallback(SERVER_FALLBACK_PAGE) to yourindex.html. - Point a domain at the IP, then enable HTTPS with
--http2plus--http2-tls-certand--http2-tls-key, or leave certificates to a proxy such as Caddy.
Static Web Server ports
Open these in your firewall if you use one: 80/tcp HTTP (default), 443/tcp HTTPS (once TLS is configured).
Static Web Server FAQ
Which SWS version should I run?
Use the v2 line for production. The project site marks v3 as a development release, so test it before you switch.
Can SWS sit behind another reverse proxy?
Yes. Keep TLS off in SWS, bind it with --host 127.0.0.1 and a local --port, and let the proxy terminate HTTPS and forward requests.
Disclaimer. The Static Web Server project has no affiliation with CloudSat and does not endorse it. Names and logos belong to their owners and appear only to identify the software.