Public | Automated Build

Last pushed: a year ago
Short Description
A simple multi-client webserver written in C
Full Description

Webserver in C


This small multi-client webserver is written as an assignment submission.
It can handle many concurrent connections and implements a basic subset of the HTTP/1.1 standard according to RFC 2616

Features (Roadmap)

  • [x] Basic HTTP GET/HEAD commands
  • [x] 200, 403 & 404 responses for files
  • [x] File MIME type detection via libmagic
  • [x] SSL/TLS support via OpenSSL
  • [x] Configurable servers via config file
  • [x] Default error pages
  • [ ] Index pages

How to run the webserver

Start by editing the configuration file, modifying servers as required.
For SSL, ensure the certificate paths are correct. All paths are relative to the webserver binary.

Ensure the config is readable from the working directory when the server starts. The certificates will be read upon the first connection to the server, so make sure to test it! (Caused by issue #4)

Specify the config on the command line with the -c flag: webserver -d -c <config-file> (Adding -d for optional daemon mode, if not specified in the config)


The following libraries are required for this program to build and run:

All of the above should be available in your package manager as <package> or <package>-dev.

Building & Running

It can be built and run with the following command:

make all run

The simplest way to run this program is via Docker. You can download run the pre-built image from DockerHub (frebib/c-webserver) by omitting the docker build step; Docker will pull the image from the repository instead.

Build the container and run it with the following commands:

docker build -t frebib/c-webserver .
docker run -d --name webserver -p 8088:8088 frebib/c-webserver

To view the output, view the logs:

docker logs -f webserver
Docker Pull Command
Source Repository