Simple HTTP server that serves files from a directory. It is written in C using the libmicrohttpd library.
- Install dependencies
- libmicrohttpd (arch:
libmicrohttpd
, debian:libmicrohttpd-dev
) - cJSON (arch:
cjson
, debian:libcjson-dev
) - libmagic (arch:
file
, debian:libmagic-dev
) -
sudo pacman -S libmicrohttpd cjson file
-
sudo apt install libmicrohttpd-dev libcjson-dev libmagic-dev
- libmicrohttpd (arch:
- Run
meson setup build
- Run
meson compile -C build
- Binary will be created at
build/http-server
The server supports directory listing and file preview.
- Read files from disk to serve
- File caching
- Cache invalidation
- MIME type detection
- Large file support (don't cache?)
- File caching
- Directory listing
- File preview
- Text
- Convert non-UTF8 text to UTF8
- Line numbers
- Syntax highlighting
- Images
- Audio
- Video
- Text
- Code cleanup
- Documentation
- Finer control over the server
- Cache control
- Custom index page
- Custom error pages
- Set specific MIME types which are served as raw data (without file preview)
- Signal to drop cache