Skip to content

salama968/C-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

C Project HTTP Server

Overview

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.

Features

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

Getting Started

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 server

Run

./server

The server listens on port 8080 by default.

Access Open your browser and go to:

About

A simple C-based HTTP server that serves static files, including HTML pages, from the project directory. The server listens on port 8080 and supports basic routing, error handling, and content-type detection for common file types. Includes a minimal example site with a root page and a blog subdirectory.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors