BWS Web Server
High-performance, multi-site web server built with Rust and Cloudflare's Pingora framework.
Features
- Multi-Site Hosting - Multiple websites with individual configurations
- Automatic SSL/TLS - Let's Encrypt integration with auto-renewal
- Reverse Proxy & Load Balancing - Multiple algorithms and WebSocket support
- Hot Reload - Zero-downtime configuration updates
- Memory Safety - Rust eliminates buffer overflows and memory leaks
- Enterprise Ready - Production-grade reliability and management
Quick Start
Instant Directory Server
# Serve current directory on port 80
# Serve specific directory on custom port
Installation
# From crates.io
# From Docker
# From source
&&
Configuration-Based Setup
Create config.toml for production:
[]
= "BWS Server"
[[]]
= "main"
= "localhost"
= 8080
= "static"
= true
[]
= false
# Multiple sites on same port (virtual hosting)
[[]]
= "blog"
= "blog.localhost"
= 8080
= "static-blog"
# Reverse proxy setup
[[]]
= "api"
= "api.localhost"
= 8080
[]
= true
[[]]
= "backend"
= "http://127.0.0.1:3001"
[[]]
= "/api/"
= "backend"
# HTTPS with automatic certificates
[[]]
= "secure"
= "example.com"
= 443
[]
= true
= true
[]
= true
= "admin@example.com"
Run
# Quick start - serve directory
# With configuration file
# Validate configuration first
Architecture
BWS uses a modular, enterprise-grade architecture:
src/
├── core/ # Foundation: types, error handling
├── config/ # Configuration management
├── handlers/ # Request processing (static, API, proxy, WebSocket)
├── middleware/ # CORS, security headers, rate limiting
├── monitoring/ # Health checks, metrics, certificate monitoring
├── server/ # Server infrastructure
└── ssl/ # SSL/TLS and certificate management
CLI Options
Configuration Validation
Validate before deployment:
# Validate configuration
# Validate before starting
&&
The validator checks:
- TOML syntax and schema compliance
- Static directories and index files
- SSL certificates and ACME settings
- Proxy upstream configurations
- Port conflicts and virtual hosting setup
Hot Reload
Update configuration without restarting:
# Reload via API
# Using signals (Unix)
What can be reloaded:
- Site configurations and hostnames
- SSL certificates and ACME settings
- Proxy routes and upstreams
- Static file directories
- Security headers
Note: Server ports require restart.
API Endpoints
BWS provides monitoring and management APIs:
GET /api/health- Server health statusGET /api/health/detailed- Detailed system informationGET /api/sites- List configured sitesPOST /api/reload- Hot reload configuration
Example:
|
Docker
# Quick start
# With custom config
Security
- Memory Safety: Rust prevents buffer overflows and memory leaks
- Zero Panics: Comprehensive error handling throughout
- Security Headers: HSTS, CSP, XSS protection built-in
- Path Traversal Protection: Secure static file serving
- Rate Limiting: Configurable request throttling
Documentation
- Quick Start Guide
- Configuration Guide
- Hot Reload Guide
- Architecture Guide
- API Documentation
- Security Guide
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/name) - Commit your changes (
git commit -m 'Add feature') - Push to the branch (
git push origin feature/name) - Open a Pull Request
License
Licensed under the MIT License.
BWS - Enterprise-grade web serving, simplified.