Skip to content

master-of-darkness/wbsrv

Repository files navigation

wbsrv

wbsrv is a high-performance, extensible web server designed for handling modern web workloads with maximum efficiency. Built in C++20 and powered by Proxygen.

⚠️ Disclaimer: This project is under active development and is not yet production-ready.


🚀 Features

  • High Performance – Handles thousands of concurrent connections with event-driven architecture.
  • Scalable – Easily configurable for multi-threaded deployments on multi-core systems.
  • Easy to Configure – YAML-based configuration files for server and virtual hosts.
  • Smart Caching – Built-in to store frequently accessed content in memory.
  • PHP Support – Native support for embedded PHP execution using the Embed SAPI.
  • Extensions API for Developers – Add new features yourself. Check out the example.

🧰 Prerequisites

Ensure the following tools and libraries are installed on a Linux-based system:

  • CMake
  • A C++20-compatible compiler (originally developed with Clang, not sure about GCC compatibility)
  • Vcpkg
  • Proxygen and dependencies
  • yaml-cpp (for configuration parsing)

🛠 Build Instructions (Ubuntu)

1. Install System Dependencies

sudo apt update
sudo apt install -y build-essential cmake clang git libssl-dev

2. Install Vcpkg

git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install

3. Install Required Libraries

./vcpkg install proxygen yaml-cpp

4. Clone the Project

git clone https://github.com/master-of-darkness/wbsrv.git
cd wbsrv

5. Build the Server

mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake ..
cmake --build .
  • Release Mode: Optimized, runs as a background service.
  • Debug Mode: Includes debug symbols, runs in the foreground.

⚙️ Configuration

Create a server.yaml by path /etc/wbsrv/ file to specify global server settings:

threads: 6

Within the same directory, create a hosts/ folder with individual virtual host configurations. Example: hosts/localhost.yaml

www_dir: "/path/to/static/files"
hostname: "localhost"
certificate: "/path/to/cert.csr"
private_key: "/path/to/key.key"
password: "/path/to/password"  # Leave empty if no password
port: 11001
ssl: true
index_page: ['index.html']

🧪 Running the Server

From the build directory:

./wbsrv

For best performance, use the Release build in production-like environments.


📦 Dependencies

  • Proxygen – HTTP framework
  • yaml-cpp – YAML configuration parser
  • xxHash - Fast hashing library for caching

🔭 Roadmap

Planned features include:

  • File upload support
  • URL-based caching for dynamic routes
  • Advanced logging and access control
  • WebSocket support
  • Improved interface for caching container

📣 Contributing

Contributions are welcome! I'm open to pull requests, issues and critiques.

About

wbsrv: Powerful webserver

Resources

License

Stars

Watchers

Forks

Releases

No releases published