PureSimpleHTTPServer is a fast, single-binary static file server for macOS, Linux, and Windows. Drop the binary next to your website files and it is ready to serve — no runtime, no interpreter, no package manager, and no configuration files required. It supports directory listing, single-page application (SPA) mode, clean URLs, URL rewriting, and structured access logging, all controlled through straightforward command-line flags.
| Platform | Minimum Version | Notes |
|---|---|---|
| macOS | 11 (Big Sur) | ARM and x86-64 binaries available |
| Linux | glibc 2.17+ | Covers most distributions from 2013 onward (RHEL 7, Ubuntu 14.04, Debian 8) |
| Windows | 10 | x86-64 only |
No external dependencies are needed. The binary is fully self-contained.
Place the binary in the same directory as your wwwroot/ folder (or any folder you want to serve):
my-site/
├── PureSimpleHTTPServer (or PureSimpleHTTPServer.exe on Windows)
└── wwwroot/
├── index.html
└── style.css
Make the binary executable on macOS and Linux:
chmod +x ./PureSimpleHTTPServerStart the server:
./PureSimpleHTTPServerThe server listens on port 8080 by default and serves files from the wwwroot/ subdirectory next to the binary.
On Windows, run from a Command Prompt or PowerShell:
.\PureSimpleHTTPServer.exeWith curl:
curl -I http://localhost:8080/A successful response returns HTTP/1.1 200 OK along with headers.
In a browser:
Open http://localhost:8080/ — your index.html (or a directory listing if --browse is enabled) will appear.
Use --root to point the server at any directory on your machine:
./PureSimpleHTTPServer --root /path/to/siteThe path can be absolute or relative to the current working directory:
./PureSimpleHTTPServer --root ./distThese five flags cover the most common scenarios. Each is covered in full in the CLI Reference.
| Flag | What It Does |
|---|---|
--port N |
Change the listening port from the default 8080 |
--browse |
Show a file listing when a directory has no index file |
--spa |
SPA mode: return index.html for every 404 (React, Vue, Angular) |
--log FILE |
Write an Apache Combined Log Format access log to FILE |
--rewrite FILE |
Load URL rewrite and redirect rules from FILE |
Quick examples:
# Run on port 3000
./PureSimpleHTTPServer --port 3000
# Enable directory listing
./PureSimpleHTTPServer --browse
# Serve a React app — all client-side routes return index.html
./PureSimpleHTTPServer --root ./build --spa
# Log every request to access.log
./PureSimpleHTTPServer --log ./logs/access.log
# Apply URL rewrite rules
./PureSimpleHTTPServer --rewrite ./rewrite.confRestrict access to your server with HTTP Basic Authentication:
./PureSimpleHTTPServer --basic-auth admin:secret123All requests require a valid Authorization header. Browsers will show a login dialog automatically. Test with curl:
curl -u admin:secret123 http://localhost:8080/Serve branded error pages instead of plain-text defaults:
./PureSimpleHTTPServer --error-pages ./errorsPlace 404.html, 403.html, and 500.html in the errors/ directory. When an error occurs, the corresponding HTML file is served automatically. Missing error page files fall back to the default plain-text response.
Set a Cache-Control: max-age value for all responses:
# Cache for 1 hour
./PureSimpleHTTPServer --cache-max-age 3600The default is max-age=0 (always revalidate). For fingerprinted assets, use a long max-age value.
Self-signed certificate (development):
# Generate a self-signed cert
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem \
-days 365 -nodes -subj "/CN=localhost"
# Run with HTTPS
./PureSimpleHTTPServer --port 8443 --tls-cert cert.pem --tls-key key.pem
# Test (skip certificate verification for self-signed)
curl -k https://localhost:8443/Automatic HTTPS with Let's Encrypt (production):
# Prerequisites: acme.sh installed, port 80 open, DNS configured
./PureSimpleHTTPServer --auto-tls example.com --root /var/wwwThe server automatically obtains a certificate, starts HTTPS on port 443, redirects HTTP→HTTPS on port 80, and renews the certificate in the background.
For production deployments, see the Deployment Guide which covers:
- Standalone — Single process, direct serving
- HTTPS Direct — Manual or automatic certificates
- Reverse Proxy — Multiple instances behind Caddy/nginx (recommended for high traffic)
- CLI_REFERENCE.md — Every flag documented with types, defaults, and examples.
- SCENARIOS.md — End-to-end recipes for common deployment patterns (SPA, reverse proxy companion, CI preview server, etc.).
- URL_REWRITING.md — Syntax and examples for the
rewrite.confrule file. - ../deployment.md — Production deployment modes and configuration.