Simple C WebServer should be an example for a minimalistic C based WebServer.
It's free to use or copy for anyone. It's meant to be forked, optimized, etc..
To compile scws from source, you'll need the following apckages preinstalled:
- libmicrohttpd-dev
sudo apt update && sudo apt-get install libmicrohttpd-dev
- libmicrohttpd
doas pkg_add libmicrohttpd
- libmicrohttpd
doas emerge net-libs/libmicrohttpd
- libmicrohttpd
sudo dnf install libmicrohttpd-devel
- libmicrohttpd-dev
brew install libmicrohttpd
git clone https://github.com/plastic-bottleneck/scws && cd scws
make
It is important to keep your
index.html
andstyle.css
files inside of the root folder of the compiled binary file. You can change the location in thescws.c
file though. To run SCWS, do this (You can also leave theip
andport
option empty to default to your local IPv4 and port 8888):
./scws [ip] [port]
When the server is running, you should get the following output:
[!!] Yay! Server is running on 0.0.0.0:8888
Now go to http://0.0.0.0:8888/ and see the following example website:
🍪 Made by Paul alias Plastic Bottleneck
GitHub: https://github.com/plastic-bottleneck
Check out my own Distro at 1.4Mb! https://github.com/plastic-bottleneck/plus-linux