A minimal, lightweight HTTP server inspired by BusyBox httpd. Designed for resource-constrained and embedded environments.
- GET requests only: Full
HTTP/1.1support for GET method - Static file serving: Serves files from configurable document root
- MIME type detection: Recognizes 25+ common file types
- Logging: Access logging with timestamps (optional)
- Directory listing: Optional directory index listing (similar to Apache/Nginx)
- Small binary: ~75 KB stripped executable on Windows
- Standard library only: No external dependencies, can be statically compiled
- Cross-platform: Works on Linux, Windows (MinGW)
# Default build
make
# With directory listing enabled
make ENABLE_DIR_LISTING=1
# With debug mode
make ENABLE_DEBUG_MODE=1
# With custom version
make VERSION="1.0.0"# Default build
gcc -Wall -Wextra -Oz -ffunction-sections -fdata-sections -fomit-frame-pointer "-Wl,--gc-sections" -DENABLE_DIR_LISTING=1 httpd.c -o httpd.exe -lws2_32
# Using Makefile
makeENABLE_DIR_LISTING: Enable directory listing (0/1, default: 0)ENABLE_DEBUG_MODE: Enable debug logging to stderr (0/1, default: 0)ENABLE_FOOTER: Show "Powered by httpdx" footer in dir listing (0/1, default: 1)VERSION: Version string displayed with-vflag (default: dev)
./httpd [options]-p PORT- Port to listen on (default: 8080)-d ROOT- Document root directory (default: current directory)-v- Show version-h- Show help message
# Listen on port 8080, serve current directory
./httpd
# Listen on port 80, serve /var/www
./httpd -p 80 -d /var/wwwText files:
- HTML, plain text, CSS, CSV, XML
Scripting:
- JavaScript (.js, .mjs), JSON
Fonts:
- WOFF, WOFF2, TTF, OTF, EOT
Images:
- PNG, JPEG, GIF, WebP, SVG, ICO
Media:
- MP4, WebM, MP3, WAV
Archives:
- ZIP, TAR, GZIP
Default: application/octet-stream for unknown types
- No HTTPS/TLS support
- No configuration files (CLI only)
- Sequential request handling (small concurrent connections)
- HTTP/1.1 only
- GET requests only
- No CGI/scripting support
Tested on:
- Linux (GCC)
- Windows 10+ (MinGW GCC)
Should work on any platform with POSIX sockets or Windows Winsock2 API.
MIT - use freely in any project.