Simple and tiny Web Server implemented in... Yes. You guessed it right, in C.
It provides a basic foundation for hosting web applications and serving static content. The server is designed to be easy to understand and modify. The purpose of this project was to learn something about webserver and network programming in C in one day and have fun :)
- Make it Concurrent
- Implements a basic HTTP/1.1 server
- Supports serving static content
Before running the web server, ensure you have the following:
- C compiler (GCC or Clang)
- CMake
- POSIX-compliant operating system (Linux, macOS, Unix)
- Clone the repo
git clone https://github.com/lvntky/nexus.c.git
- Navigate to the project directory:
cd nexus.c
- Compile the source code
cmake ./
- Run the server
./nexus
- By default, the server listens on localhost (port 8080). You can access it in your web browser by navigating to http://localhost:8080
You can modify the server's behavior by adjusting the values in the config.h file. Here are some options you might want to customize:
-
PORT
: The port number the server listens on (default: 8080). -
THREAD_POOL_SIZE
: The maximum number of threads that handle incoming requests -
WEB_ROOT
: The directory where the server looks for static files (default: "./public").
Contributions are welcome! If you find any bugs or have suggestions for improvements, please open an issue or submit a pull request. Make sure to follow the existing coding style and provide appropriate test coverage.
This project is licensed under the MIT License.
- HTTP Server: Everything you need to know to Build a simple HTTP server from scratch
- HTTP RFC
- Micheal Kerrisk - The Linux Progrraming Interface, Ninth Printing ed.
- Time Wait State