HTTP server created using C++ to demonstrate HTTP protocol.
- Get the source
git clone https://github.com/devesh-21-hub/cpp-http-server
cd HttpServer
- Edit Config
Set the
www
data storage directory:
vim common.h
Set the variable server_dir
to /home/YourName/www
or any other directory you prefer.
- Start The Server First compile the source code, and then run the executable file:
make
./xhttp
The server is started if it shows the following message,
-HTTP Server [xhttp] started...
- Test a Webpage
Copy the files inwww
to yourserver_dir
setted in the 2nd step,
cp ./www/* %server_dir%
Open your browser and enter the url localhost:8080/index.html
.
Then it will shows the webpage stored on your localhost.
This program is a simple HTTP server. It runs only on Linux/Unix plantforms.
For more about HTTP protocol, please refer to its wiki:
Hypertext_Transfer_Protocol