This project is about coding our own webserver in C++, mimicking the behaviour of NGINX. It is a group project done with Lola Le and Selina Pradel
The full subject can be found here.
Clone the repository and use make
to compile
git clone https://github.com/theozanchi/42_Berlin_webserv/tree/main
cd 42_Berlin_webserv
make
The program can be launched with or without an argument. The argument is a configuration file that has to follow the format of nginx.conf
files:
server {
listen 8080;
host localhost;
server_name www.default.com default.com;
root ./content/default_website;
# Default error pages configuration
error_page 404 "./content/error/404.html";
error_page 405 "./content/error/405.html";
error_page 500 502 503 504 "./content/error/50x.html";
# Limit client body size
client_max_body_size 10M;
client_body_in_file_only on;
client_body_buffer_size 128K;
client_body_timeout 30s;
location / {
# Define accepted HTTP methods
allow GET;
# Set a default file to answer if the request is a directory
index "index.html" "index.htm";
# Directory listing settings
autoindex off;
}
}
The target make go
can be used to directly build the executable and launch it with a config file named webserv.conf
:
- Multiplexing using
poll()
- HTTP 1.1 with methods
GET
,POST
andDELETE
- Possibility to upload files
- CGI interface supporting
C++
- Redirections