webserv is a 42 project: You must recreate a static web server (like nginx).
- 125/100 ✅
- HTTP/1.1 support
- Keep-Alive connection handling
- Redirections (3xx)
- Static file serving
- Custom error pages
- Directory listing
- File upload
- File deletion
- CGI execution (e.g. Python scripts)
- Configurable max body size
- CGI timeout handling
- Logger (DEBUG, INFO, WARNING, ERROR, CRITICAL)
- File logging
Below is a working configuration example:
[
{
"name": "my awesome website",
"keepalive_timeout": 30,
"max_body_size": 8080,
"listen": "0.0.0.0:8080",
"locations": [
{
"uri": "/",
"path": "/path/to/location"
},
{
"uri": "/error",
"path": "/path/to/location/error"
}
],
"document_index": "/index.html",
"error_pages": [
{
"error_code": 404,
"uri": "/error/404.html"
},
{
"error_code": 500,
"uri": "/error/500.html"
}
],
"allowed_methods": ["GET", "POST"],
"redirections": [
{
"uri": "/github",
"redirect": "https://github.com/etienne-hd/"
}
],
"directory_listing_enabled": true,
"file_on_directory": "/file_on_directory.html",
"file_upload_enabled": true,
"file_upload_directory": "/files",
"cgi_enabled": true,
"cgi_rules": [
{
"extension": ".py",
"path": "/bin/python"
}
],
"cgi_timeout": 15
}
]