darkhttpd
simple, fast, and secure static web server
TLDR
Serve the current directory on the default port
SYNOPSIS
darkhttpd docroot [--port port] [--addr address] [--daemon] [--log file] [--index file] [options]
DESCRIPTION
darkhttpd is a simple, fast, and secure static web server. Written in C with no dependencies, it compiles to a single small binary that can serve static files with minimal resource usage.
The server is designed for simplicity: it serves files from a document root directory with proper MIME types, handles HTTP/1.1 keep-alive connections, and supports security features like chroot and privilege dropping. There's no configuration file; all options are command-line arguments.
Directory listing can be enabled with the --index flag (without a filename argument). Custom index files can be specified to override the default index.html. The server sends proper caching headers and handles range requests for resumable downloads.
For production use, darkhttpd supports daemonization, PID file creation, and logging. The chroot and uid/gid options provide security isolation. While not designed for high-traffic sites, it's excellent for local development, embedded systems, or serving static content where simplicity is valued.
PARAMETERS
--port port
Port to listen on (default: 8080).--addr address
Address to bind to (default: all interfaces).--daemon
Fork into background.--pidfile file
Write PID to file when daemonized.--log file
Log requests to file (- for stdout).--index file
Default index file (or flag alone enables directory listing).--no-listing
Disable directory listing.--timeout seconds
Connection timeout (default: 60).--uid uid
Drop privileges to this user ID.--gid gid
Drop privileges to this group ID.--chroot
Chroot to docroot.--forward host url
Forward requests for host to URL.--forward-https host url
Forward HTTPS-originated requests.--no-keepalive
Disable HTTP keep-alive.--mimetypes file
Load MIME types from file.
CAVEATS
Static files only; no CGI, PHP, or dynamic content support. No SSL/TLS; use a reverse proxy for HTTPS. No configuration file; all settings via command line. Limited to HTTP/1.1 features. Not suitable for high-concurrency production workloads.
HISTORY
darkhttpd was created by Emil Mikulic in 2003 as a simple, portable HTTP server. The design philosophy emphasizes minimalism and security over features. The single-file C source compiles on virtually any Unix-like system without external dependencies, making it popular for embedded systems and minimal environments.
