This project is about writing a HTTP server, similar to Nginx, Apache or Lighttpd.
Webserv is a group project at 42 which requires us to build a HTTP server using I/O Multiplexing built on top of an event loop.
In the mandatory part, we start the server by reading a configuration file loosely based on Nginx configuration options, allowing customization of features such as, hostname(ip/port), servername, index file, directory listing, URL redirect, location(vhost path), among other settings. It is forbidden to use fork to create new non-CGI processes or spawn threads (threads are not available in C++98).
Using I/O Multiplexing the Kernel informs the server of any incoming and outgoing data availability in monitored file descriptors; we can use select, poll, epoll or kqueue. Prior to reading or writing in a socket it is strictly required that the server goews through poll() or equivalent, ensuring high server availability, respecting the event loop.
HTTP requests are read, parsed, processed and sent to a CGI, which can be customized in the configuration file and finally a HTTP response is returned to the client with headers, body and correct HTTP status code.
For the bonus we have to support cookies, session management and handle multiple CGI.
- Network & system administration
- Unix
- Rigor
- Object-oriented programming
Follow the steps below
# Clone the project and access the folder
git clone https://github.com/VLN37/webserv && cd webserv/
# Run make so you can build the program and install dependencies
# the dep directive asks for sudo permissions in order to install php-cgi
make && make dep
# Run the application with the provided configuration file
./webserv default.conf
# Access the default website using the URL below
http://localhost:3490
# Clean output objects with
make fclean
# Well done!
The project is regularly updated with bug fixes and code optimization.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Made by:
João Rodriguez 👋 See my github
Paulo Santana 👋 See my linkedin
Welton Leite 👋 See my linkedin