Skip to content

waqarNaeem786/http-server-in-c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple HTTP Server in C

A minimalist HTTP server written in C that serves an index.html file on port 8080.

Website running in browser

Prerequisites

  • GCC compiler
  • POSIX-compliant system (Linux, macOS, etc.)
  • index.html file in the same directory as the server

Build

gcc -Wall server.c -o server -pthread

Run

./server

Makefile

make
make clean
  1. Place an index.html file in the same directory as the server.
  2. Open a browser and navigate to http://localhost:8080.

Notes

  • The server handles GET requests for / and returns index.html.
  • Other requests receive a 404 response.
  • Uses POSIX threads for concurrent client handling.
  • Ensure port 8080 is free.

About

Multithreaded webserver made in C as mini project to better understand the socket programming and Networking.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages