A lightweight HTTP server implemented in C++ that handles basic HTTP requests. This server is designed to be simple, efficient, and easy to extend.
- Simple HTTP server that runs on localhost
- Handles basic HTTP GET requests
- Configurable port
- Basic error handling and logging
- Clean, modular code structure
- C++ compiler (tested with GCC/G++ 6.3.0)
- Git
- Windows, Linux, or macOS
cpp-http-server/
├── build/ # Build outputs and artifacts
├── include/ # Header files
├── src/ # Source files
│ └── main.cpp # Main program entry point
├── .gitignore # Git ignore file
└── README.md # This README
-
Clone the repository:
git clone https://github.com/yourusername/cpp-http-server.git cd cpp-http-server -
Compile the project:
g++ -o build/server src/main.cpp -std=c++11
-
Start the server:
./build/serverOn Windows:
build\server.exe -
The server will start on localhost (127.0.0.1) port 8080 by default.
-
Test the server by opening a web browser and navigating to:
http://localhost:8080Or using curl:
curl http://localhost:8080
You can modify the port by changing the PORT constant in the source code.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.