# httpserver **Repository Path**: agstar/httpserver ## Basic Information - **Project Name**: httpserver - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-21 - **Last Updated**: 2026-04-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: Rust, Python ## README # httpserver 一个用 Rust 编写的轻量级 HTTP 服务器启动工具,基于 Python 内置 HTTP 服务器模块。 ## 功能特性 - 自动检测 Python 版本(Python 2/3)并使用对应模块 - 自动检测本机 IPv4 地址(过滤虚拟网卡) - 端口占用时自动递增寻找可用端口 - 启动时列出当前目录可用文件及访问地址 - 支持 `Ctrl+C` 优雅关闭服务器 - 跨平台支持(Windows / Linux / macOS) ## 环境要求 - [Rust](https://www.rust-lang.org/tools/install)(edition 2021+) - 系统已安装 Python 2 或 Python 3 并在 `PATH` 中可用 ## 构建 ```bash # 调试构建 cargo build # 发布构建(体积优化) cargo build --release ``` ## 使用方法 ```bash # 使用默认端口 8000 启动 httpserver # 指定端口 httpserver -p 3000 # 绑定到指定地址 httpserver -b 192.168.1.100 # 指定服务目录 httpserver -d /path/to/dir # 组合使用 httpserver -p 3000 -b 0.0.0.0 -d ./public ``` ## 命令行参数 | 参数 | 简写 | 说明 | 默认值 | | ----------------- | ---- | -------------- | -------- | | `--port ` | `-p` | 监听端口 | `8000` | | `--bind ` | `-b` | 绑定地址 | 自动检测 | | `--directory` | `-d` | 服务目录 | 当前目录 | ## 许可证 MIT