![Actions Status](https://github.com/biluohc/fht2p/workflows/CI/badge.svg)
中文
fht2p is a cross-platform HTTP static file server developed using Rust. The CI test covers Linux, MacOS and Windows.
Features
- Reliable: Implemented in Rust, integrated testing, safe and reliable
- Universal: Fully cross-platform, available for both Unix-like and Windows systems
- Convenient: static linking, does not depend on external dynamic libraries such as openssl, download and use
- Fast: Asynchronous multi-threaded, built on tokio and hyper, fast response, massive concurrency
- Functions: file download and upload, directory browsing, resume from breakpoint, proxy function, configuration options, everything
Functions
- Multi-path sharing
- File breakpoint resume
- Closeable directory browsing (and sorting and other functions)
- HTTP Cache
- File upload, make directory
- HTTPS (tokio-rustls, does not depend on external dynamic libraries)
- HTTP proxy (tunnel proxy, general proxy)
- Basic Authentication
- Cross-Origin Resource Sharing (CORS)
- Directory page compression (GZIP)
- Command line arguments
- Configuration file (format is json5, similar to json but supports comments, etc.)
- Terminal log optional level
- Output service's URL at startup, output QR code optionally
Snapshot
![snapshot.png](https://raw.githubusercontent.com/biluohc/fht2p/master/config/assets/snapshot.png)
Install
1. Download from Releases
2. Compile from Source Code
cargo install --locked --git https://github.com/biluohc/fht2p fht2p -f
# cargo install --locked --git https://github.com/biluohc/fht2p --branch dev fht2p -f
fht2p -h
Or
git clone https://github.com/biluohc/fht2p
# cargo install --locked --path fht2p/ fht2p -f
cd fht2p
cargo build --release
./target/release/fht2p --help
Tips
-
View help information by using the --help option
-
View the default configuration content by using the --config-print option.
-
See a complete configuration example from the config directory under this project.
-
About the priority of options and profiles
The default configuration file is located in $HOME/.config/fht2p/fht2p.json
, you can create if it doesn't exist.
There are four types of options:
- The first is --help, --version and --config-print. Programs will exit very quickly, regardless of priority.
- The second is --verbose and --qr-code They ignore priority and have no conflict with other options
- The third is --config specifies the configuration file, the fourth option is ignored
- The fourth is other options and parameters, once you have it, the default configuration file will be ignored (this is to prevent the priority from being too complicated)
-
About security and HTTPS
- HTTP is a plain text protocol based on TCP. There is no security at all. If security is required, HTTPS must be used.
- The program listens to the local loopback address (
127.0.0.1
) by default for security. If you want to access outside the machine, you can monitor0.0.0.0
or a specific address and configure your firewall
- The program listens to the current directory by default. Please do not share the home directory or the root directory on the network unless you understand what you are doing