| Crates.io | bws-web-server |
| lib.rs | bws-web-server |
| version | 0.4.1 |
| created_at | 2025-08-23 04:04:30.912083+00 |
| updated_at | 2025-08-30 09:02:49.646224+00 |
| description | BWS - High-performance multi-site web server built with Pingora |
| homepage | https://github.com/benliao/bws |
| repository | https://github.com/benliao/bws |
| max_upload_size | |
| id | 1807221 |
| size | 967,767 |
High-performance, multi-site web server built with Rust and Cloudflare's Pingora framework.
# Serve current directory on port 80
bws .
# Serve specific directory on custom port
bws /path/to/website --port 8080
# From crates.io
cargo install bws-web-server
# From Docker
docker run -d -p 8080:8080 ghcr.io/benliao/bws:latest
# From source
git clone https://github.com/benliao/bws.git && cd bws
cargo build --release
Create config.toml for production:
[server]
name = "BWS Server"
[[sites]]
name = "main"
hostname = "localhost"
port = 8080
static_dir = "static"
default = true
[sites.ssl]
enabled = false
# Multiple sites on same port (virtual hosting)
[[sites]]
name = "blog"
hostname = "blog.localhost"
port = 8080
static_dir = "static-blog"
# Reverse proxy setup
[[sites]]
name = "api"
hostname = "api.localhost"
port = 8080
[sites.proxy]
enabled = true
[[sites.proxy.upstreams]]
name = "backend"
url = "http://127.0.0.1:3001"
[[sites.proxy.routes]]
path = "/api/"
upstream = "backend"
# HTTPS with automatic certificates
[[sites]]
name = "secure"
hostname = "example.com"
port = 443
[sites.ssl]
enabled = true
auto_cert = true
[sites.ssl.acme]
enabled = true
email = "admin@example.com"
# Quick start - serve directory
bws static --port 8080
# With configuration file
bws -c config.toml
# Validate configuration first
bws -c config.toml --dry-run
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
bws # Use config.toml
bws --config custom.toml # Custom config file
bws /path/to/directory # Serve directory directly
bws /path/to/directory --port 8080 # Custom port
bws --verbose # Enable debug logging
bws --daemon # Background process (Unix only)
bws --dry-run # Validate configuration
Validate before deployment:
# Validate configuration
bws --config config.toml --dry-run
# Validate before starting
bws --config production.toml --dry-run && bws --config production.toml
The validator checks:
Update configuration without restarting:
# Reload via API
curl -X POST http://localhost:8080/api/reload
# Using signals (Unix)
kill -HUP $(pgrep -f "bws.*master")
What can be reloaded:
Note: Server ports require restart.
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 configurationExample:
curl http://localhost:8080/api/health
curl http://localhost:8080/api/sites | jq
curl -X POST http://localhost:8080/api/reload
# Quick start
docker run -d -p 8080:8080 ghcr.io/benliao/bws:latest
# With custom config
docker run -d \
-p 8080:8080 \
-v $(pwd)/config.toml:/app/config.toml:ro \
-v $(pwd)/static:/app/static:ro \
ghcr.io/benliao/bws:latest
git checkout -b feature/name)git commit -m 'Add feature')git push origin feature/name)Licensed under the MIT License.
BWS - Enterprise-grade web serving, simplified.