This project is a basic example of a simple HTTP web server written in C++. It uses UNIX socket API to handle HTTP requests and responses.
Basic socket programming with C++ Minimal error handling Serves a single, hard-coded HTML file Single-threaded, handles one client at a time
C++ compiler (e.g., g++, clang) UNIX-like operating system (Linux, macOS) and CMake installed
Clone the repository:
git clone https://github.com/Dominik-Lamcha/Simple_http_server.gitNavigate into the project directory:
cd Simple_http_serverCompile the C++ file using CMake tools:
mkdir build
cd build
cmake ..
makeRun the server:
./SIMPLE_HTTP_SERVER path/to/index.htmlAfter running the server, navigate to http://localhost:8080 in your web browser. You should see the HTML content served by the server.
The server only serves a single, hard-coded HTML file. No support for concurrent clients. Each client must wait for the previous one to disconnect before they can be served. Does not fully parse incoming HTTP requests. Minimal error handling.
Feel free to fork this repository and contribute. Pull requests are welcome.