Warning
This software is not yet ready for production use as it lacks security features.
A web server written in C++ with TLS support, inspired by the Express.js framework.
To build this project, you need to install the following libraries:
- openssl: For SSL/TLS support.
- spdlog: For logging functionality.
If you want to run the tests, you must also install the gtest library, though it's not required for building the
binary. You may also need the typical development tools like gcc
, g++
and cmake
.
sudo apt install -y cmake libgtest-dev libspdlog-dev
-
Create a build directory:
mkdir build cd build
-
Configure the project using
cmake
:cmake -DCMAKE_BUILD_TYPE=Release ..
-
Build the project with
make
:make -j$(nproc)
Docker images are built from the master
branch and published on ghcr.io
. You can find an
example Dockerfile and docker-compose.yml in this repository to help you run the
server in a container.
The web server will look for a file named config
in the current working directory. This file is optional but can be
used to configure the following parameters:
port: 8080 # Defaults to "8080"
log_level: info # Defaults to "info"
cert: cert.pem # Path to your SSL certificate
key: key.pem # Path to your SSL key
If cert
or key
are not provided, TLS will be disabled.
The available logging levels are:
trace
debug
info
(default)warn
err
critical
off
To enable TLS support, you need an SSL certificate. You can generate a self-signed certificate using the following command:
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
Modify the config
file to specify the paths to your certificate and key:
cert: cert.pem
key: key.pem
After generating and modifying the config
file the certificate, run the server:
./build/web_server_reboot
Contributions are welcome! If you encounter any issues or have suggestions for improvement, please submit an issue or pull request on GitHub. Make sure to follow the existing code style and include relevant tests.
- Fork the repository.
- Create a new branch
git checkout -b <branch-name>
. - Make changes and commit
git commit -m 'Add some feature'
. - Push to your fork
git push origin <branch-name>
. - Submit a pull request.