This project is a simple webserver written in C that supports simple HTTP features and CGI. It was developed as part of the Communication Networks II subject at college. Authors: Alejandro Bravo de la Serna and Miguel González González.
To build the server's executable, just run make from the project's root. Library confuse, which corresponds to package libconfuse-dev, needs to be installed. This will result in the file server.
The server.conf file allows to tweak certain parameters:
- server-root : Path, relative to the program's file, that will store the web contents. Files above this path will never be returned by the server.
- max-clients : Maximum number of clients that can connect to the server in a given moment. More connections will result in waits or refusings, as specified in listen-queue
- listen-port : Must be an unusued port in which the server will start listening.
- server-signature : Server name that will be included in response header files.
- daemon-mode : Determines whether the server shall run "as is" (0) or should launch itself as a daemon (1). In any case, server output will be produced in the system log (syslog).
- listen-queue : Number of incoming connections that will be put on hold, in case max-clients has been attained, before starting to refuse.
- read-timeout : Number of seconds that will be waited before sending a 408 request timeout on nonresponding clients.
It suffices to include the website objects in the server-root path and run the server. The website root shall be named index.html.
In order to properly stop the server, it must be signaled with a SIGINT. If running on an active terminal, this can be achieved by pressing Ctrl+C. Otherwise, use the kill command (kill -INT ). A shell script, killServer.sh, is included to automatically send the signal to the server. (CAUTION. Be aware that if other processes have the same name as the server one, they might be signaled as well. Script was included for debugging convenience, and shall never be used to stop the server in serious environments).
Kindly refer to the project's wiki to find out about what is supported, some details about the design, and some possible future roadmap.