Servum is a simple static server. Not more. Not less.
It is fast* and comes with no external dependencies. Servum also supports multi-threaded, parallel processing of incoming requests. HTTP only.
Install servum from the Releases Tab.
Then run servum
inside the directory you want to serve 🚀.
Pre-built binaries for Windows, Mac and Linux can be found under the Releases Tab.
To install the binary system-wide on Linux, make sure it is executable before
moving it to usr/bin
:
# In your Downloads folder:
chmod a+x ./servum
sudo mv ./servum /usr/bin/
To install the binary on windows, you can move it to C:\Tools
as recommended
in this StackExchange question:
https://superuser.com/questions/532460/where-to-install-small-programs-without-installers-on-windows
If you would like to have a shortcut in the start menu, you can right-click the .exe file and select "Pin to start" before running it. See this stack-exchange question for more info: https://superuser.com/questions/1189406/ctrlshiftenter-to-run-as-admin-works-on-desktop-app-programs-but-not-run?answertab=votes#tab-top
If you're a Rust programmer, servum can be installed via cargo.
cargo install --git https://github.com/umcconnell/servum.git --branch main --bin cargo-servum
To get started, just run servum
, or cargo servum
if you've installed using
cargo, in the directory you want to serve.
servum [optional: BASE_DIR] [optional: OPTIONS]
servum takes an optional path to the base directory, i.e. the root directory you want to serve. This defaults to the current directory.
Additional configuration, such as the port, address, number of threads to use,
etc., is possible using further CLI arguments. Run servum --help
to get help.
The speed test consisted of serving the example folder on a laptop (Intel i7-9750H) using a single thread. Performance was measured using wrk with 6 threads and 400 connections for 60s:
wrk -t6 -c400 -d60s http://localhost:8080/index.html
Server | Notes | Requests/sec | Transfer/sec | Errors |
---|---|---|---|---|
1. servum | 1 thread | 41176.04 | 42.21MB | / |
2. nginx | from docker container | 27036.48 | 31.69MB | / |
3. serve | node | 16683.90 | 2.69MB | / |
4. python3 | module http.server |
1135.15 | 1.27MB | 19 timeouts |
Servum is open source! Contributions, improvements, bug fixes, etc. are very welcomed.
Before you get started, make sure you've got rust and cargo installed on your machine. If not, installation via rustup is quick and easy. See the rust website for installation instructions: https://www.rust-lang.org/tools/install
First, clone the repo with git:
git clone https://github.com/umcconnell/servum.git
cd servum
Then, you can run servum using cargo:
cargo run [BASE_DIR] [OPTIONS]
... or build a binary:
cargo build --release
Check out the examples folder for an example static website.
Happy coding!
The developer docs are available online: https://umcconnell.github.io/servum/servum/index.html
Docs can also be built and viewed locally using:
cargo doc --document-private-items --open
Tests can be run using:
cargo test
When adding new features, make sure to add tests to your code.
Please read CONTRIBUTING.md and CODE_OF_CONDUCT.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
Ulysse McConnell - umcconnell
See also the list of contributors who participated in this project.
servum is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.
A huge thanks goes to the open and welcoming rust community and their great documentation effort. This project is based off Chapter 12 of the Rust Book "Building a Multithreaded Web Server"
- Chapter 12: https://doc.rust-lang.org/stable/book/ch20-00-final-project-a-web-server.html
- https://doc.rust-lang.org/book/
- https://blog.burntsushi.net/rust-error-handling/
- https://www.reddit.com/r/rust/comments/gj8inf/rust_structuring_and_handling_errors_in_2020/
- https://alican.codes/rust-github-actions/