基于 Rust 实现的高性能 HTTP 服务器和反向代理,注重可靠性、性能和配置简便性。
Rginx 基于现代 Rust 生态系统构建,使用 Tokio 作为异步运行时,Hyper 处理 HTTP 协议。提供静态文件服务和可配置负载均衡的反向代理功能。
- tokio: 异步运行时和 I/O 操作
- hyper: HTTP/1.1 协议实现
- serde: 配置序列化
- log: 结构化日志
# 构建项目
cargo build --release
# 运行服务器
cargo run --releaseworkers: 4
logging: true
servers:
- listen: 127.0.0.1:9001
server_name: main_server
routes:
"/":
type: static
root: "./public"
"/api":
type: proxy
target: "http://localhost:3000"src/
├── main.rs # 程序入口
├── config/ # 配置管理
├── server/ # 服务器实现
├── handlers/ # 请求处理器
└── commons/ # 公共工具
MIT 许可证