A functional web server built in C++ for the 42 school common core.
Non-blocking I/O with select for multiplexing, RFC-Compliant HTTP request parsing and response construction, and more. Configurable via .conf files.
Lines 1 to 43 in fb62f72
server { | |
listen 80 | |
server_name localhost | |
error_page 400 ./www/errors/400.html | |
error_page 403 ./www/errors/403.html | |
error_page 404 ./www/errors/404.html | |
error_page 405 ./www/errors/405.html | |
error_page 500 ./www/errors/500.html | |
error_page 501 ./www/errors/501.html | |
error_page 504 ./www/errors/504.html | |
client_max_body_size 5M | |
location / { | |
root ./www/ | |
index index.html | |
} | |
location /cgi/ { | |
root ./cgi/ | |
cgi .py /Users/mrattez/.brew/bin/python3 | |
cgi .pl /usr/bin/perl | |
upload_path ./www/upload/ | |
accepted_methods GET POST | |
} | |
location /uploads/ { | |
root ./www/upload/ | |
autoindex on | |
accepted_methods GET DELETE | |
} | |
location /youtube/ { | |
return 301 https://www.youtube.com/ | |
} | |
location /google/ { | |
return 301 https://www.google.com/ | |
} | |
} |