A simple HTTP server written in C that serves static files from the project directory. It supports basic routing, error handling, and content-type detection for common file types.
Serves HTML, CSS, JS, images, and other static files Handles root and subdirectory requests (e.g., /, blog) Returns appropriate HTTP status codes (200, 404, 500, etc.) Detects content type based on file extension
Prerequisites
- GCC or Clang (for compiling C code)
- Linux or macOS (uses sendfile; Windows is not supported out of the box) Build
gcc server.c -o serverRun
./serverThe server listens on port 8080 by default.
Access Open your browser and go to: