Skip to content

A non-blocking HTTP server in C++98 that supports GET/POST/DELETE, serves static sites, handles file upload/delete, runs CGI scripts (e.g. Python), and listens on multiple ports. Uses a config file, handles concurrent clients via poll().

License

Notifications You must be signed in to change notification settings

hienptx/42_Mini_Http_Server

Repository files navigation

Webserv

A simple C++ HTTP web server implementation following the 42 school project specifications.

🛠️ Build Instructions

This project requires a C++17-compatible compiler.

1. Clone the repository

git clone https://github.com/hienptx/42_Mini_Http_Server.git
cd 42_Mini_Http_Server

2. Build the project

make

This compiles all source files in the src/ directory and creates the webserv executable in the project root.

Usage

./webserv webserv.conf
  • webserv.conf is the configuration file describing server blocks, ports, routes, etc.
  • The format and syntax follow an nginx-style layout.

Project Structure

.
├── includes/        # Header files
├── obj/             # Compiled object files (generated)
├── src/             # Source code files
├── webserv.conf     # Example configuration file
├── webserv          # Final executable (after make)
└── Makefile         # Build system

Features

  • HTTP 1.1 compliant
  • Supports GET, POST, and DELETE methods
  • Static file serving
  • CGI execution
  • Configurable routing via webserv.conf
  • Handles multiple client connections using select/poll

Example

Run the server:

./webserv webserv.conf

Access it in your browser:

http://localhost:<configured_port>

Cleaning Up

make clean   # Remove object files
make fclean  # Remove object files and executable
make re      # Full rebuild

License

This project is for educational purposes under the 42 school curriculum.

About

A non-blocking HTTP server in C++98 that supports GET/POST/DELETE, serves static sites, handles file upload/delete, runs CGI scripts (e.g. Python), and listens on multiple ports. Uses a config file, handles concurrent clients via poll().

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •