A concurrent HTTP/1.1 server written in C from scratch — no libraries, just POSIX sockets.
- Parses raw HTTP/1.1 GET requests
- Serves static files with correct
Content-Typeheaders (HTML, CSS, JS, PNG, JPEG) - Fork-based concurrency — each client handled in a separate process
- SIGCHLD handler to reap zombie processes
- Apache-style request logging with timestamps
make./serverServes files from ./www on port 8080 by default. Open http://localhost:8080 in your browser.
You can also pass a custom port:
./server 9090http-server/
├── src/
│ ├── main.c # Entry point, port handling
│ ├── server.c # Socket setup, accept loop, fork concurrency
│ ├── request.c # HTTP request parser
│ └── response.c # HTTP response builder, file serving
├── include/
│ └── server.h # Shared types and function declarations
├── www/
│ └── index.html # Static files served by the server
└── Makefile
[*] HTTP server listening on port 8080
[*] Serving files from ./www
[2026-06-08 22:05:14] 127.0.0.1 "GET /" 200
[2026-06-08 22:05:14] 127.0.0.1 "GET /favicon.ico" 200