index : static-web-server.git

ascending towards madness

author Jose Quintana <joseluisquintana20@gmail.com> 2021-10-25 23:08:45.0 +00:00:00
committer Jose Quintana <joseluisquintana20@gmail.com> 2021-10-25 23:08:45.0 +00:00:00
commit
a668329d6faacfb1a9692f545a3695e488d7fab8 [patch]
tree
007200cc398a00a582b037127c94bdf6754dc89a
parent
bf6ac4d9d42aa59019777ea90437cf964dd824f9
download
a668329d6faacfb1a9692f545a3695e488d7fab8.tar.gz

docs: preliminary website [skip ci]



Diff

 docs/changelog-v1.md                            | 491 +++++++++++++++++++++++++-
 docs/changelog-v2.md                            | 370 +++++++++++++++++++-
 docs/configuration/command-line-arguments.md    |  83 ++++-
 docs/configuration/environment-variables.md     |  58 +++-
 docs/contributions.md                           |   5 +-
 docs/download-and-install.md                    |  26 +-
 docs/examples/basic-authentication.md           |  23 +-
 docs/examples/compression.md                    |   1 +-
 docs/examples/directory-listing.md              |   1 +-
 docs/examples/docker.md                         |  54 +++-
 docs/examples/file-descriptor-socket-passing.md |  14 +-
 docs/examples/http1.md                          |   2 +-
 docs/examples/http2-tls.md                      |   1 +-
 docs/examples/logging.md                        |   1 +-
 docs/getting-started.md                         |  13 +-
 docs/index.md                                   |  91 +++--
 docs/license.md                                 |   5 +-
 docs/platforms-architectures.md                 |  48 ++-
 mkdocs.yml                                      |  84 ++--
 19 files changed, 1312 insertions(+), 59 deletions(-)

diff --git a/docs/changelog-v1.md b/docs/changelog-v1.md
new file mode 100644
index 0000000..c5d8864
--- /dev/null
+++ b/docs/changelog-v1.md
@@ -0,0 +1,491 @@
# Static Web Server v1 - Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog]https://keepachangelog.com/en/1.0.0/,
and this project adheres to [Semantic Versioning]https://semver.org/spec/v2.0.0.html.

_**Note:** See changelog for v2 under the [master]https://github.com/joseluisq/static-web-server/blob/master/CHANGELOG.md branch._

## v1.18.0 - 2021-08-20

__Updates__

- [806a276]https://github.com/joseluisq/static-web-server/commit/806a276 Update dependencies including OpenSSL, httparse and related crates.

__Refactorings__

- [c9e7222]https://github.com/joseluisq/static-web-server/commit/c9e7222 Cross-platform `ctrl-c` signal handling including Windows support.
- [3c7d9f6]https://github.com/joseluisq/static-web-server/commit/3c7d9f6 Remove needless borrow on server module.

__Docs__

- [5a14787]https://github.com/joseluisq/static-web-server/commit/5a14787 Changelog support for v1. PR [#50]https://github.com/joseluisq/static-web-server/pull/50

## v1.17.1 - 2021-06-30

__Fixes__

- [f976586]https://github.com/joseluisq/static-web-server/commit/f976586 Fix static file base path not resolved (canonicalized) properly. For example when uri paths map to symlinks on file system.
- [35d5a1e]https://github.com/joseluisq/static-web-server/commit/35d5a1e Fix missing server version env of "scratch" Dockerfile.

__Updates__

- [1fc9d7f]https://github.com/joseluisq/static-web-server/commit/1fc9d7f Update dependencies 30.06.2021.

__Docs__

-  [8979292]https://github.com/joseluisq/static-web-server/commit/8979292 Describe current supported targets.

__Refactorings__

- [34cd35b]https://github.com/joseluisq/static-web-server/commit/34cd35b Minor config project updates.

## v1.17.0 - 2021-06-21

__Updates__

- [54ae2d9]https://github.com/joseluisq/static-web-server/commit/54ae2d9 Update dependencies which includes OpenSSL crate updates and others (also [299e01c]https://github.com/joseluisq/static-web-server/commit/299e01c).

__Features__

-  [f78de5a]https://github.com/joseluisq/static-web-server/commit/f78de5a Additionally to current three targets `x86_64-unknown-linux-musl`, `x86_64-apple-darwin`, `x86_64-pc-windows-msvc`. We are supporting six ones more, among which five ARMs stand out:
    - `x86_64-unknown-linux-gnu`
    - `aarch64-apple-darwin`
    - `aarch64-pc-windows-msvc`
    - `aarch64-unknown-linux-gnu`
    - `aarch64-unknown-linux-musl`
    - `arm-unknown-linux-gnueabihf`

Find those targets attached to this release.

__Refactorings__

- [bf87d7f]https://github.com/joseluisq/static-web-server/commit/bf87d7f Improve error messages for address binding errors. PR [#43]https://github.com/joseluisq/static-web-server/pull/43
- [842be1d]https://github.com/joseluisq/static-web-server/commit/842be1d Update Docker files in order to get the new Linux binary source.

__Note about releases__

[Rust Nightly]https://doc.rust-lang.org/book/appendix-07-nightly-rust.html is powering the releases from now on the CI. This makes possible to reach more targets in the future.
For more details about it see [Rust Nightly targets supported]https://doc.rust-lang.org/nightly/rustc/platform-support.html.
However clarify that the `static-web-server` project is not using any nightly feature but only _**stable Rust**_ ones and also the project is tested against nightly and stable Rust on CI recurrently in order to be notified in case of _"regressions or bugs introduced in Nightly Rust"_. However it is [known]https://stackoverflow.com/a/56067977/2510591 that the nightly compiler is very stable therefore the reason why we have chosen it for release targets via CI like many other popular Rust projects.
In any case, don't hesitate to file an issue.

## v1.16.0 - 2021-05-26

__Updates__

- [b0593ff]https://github.com/joseluisq/static-web-server/commit/b0593ff Binaries compiled with latest Rust [1.52.1]https://blog.rust-lang.org/2021/05/10/Rust-1.52.1.html release.
- [c96cd48]https://github.com/joseluisq/static-web-server/commit/c96cd48 Update dependencies 26.05.2021

## v1.15.0 - 2021-04-20

__Features__

- [8cf7909]https://github.com/joseluisq/static-web-server/commit/8cf7909 Binaries compiled with latest Rust [1.51.0]https://blog.rust-lang.org/2021/03/25/Rust-1.51.0.html release.
- [cfbffb8]https://github.com/joseluisq/static-web-server/commit/cfbffb8 [Alpine 3.13]https://alpinelinux.org/posts/Alpine-3.13.0-released.html Docker image.

__Updates__

- [12824ed]https://github.com/joseluisq/static-web-server/commit/12824ed Update dependencies 20.04.2021 (also [996c181]https://github.com/joseluisq/static-web-server/commit/996c181, [c383b8a]https://github.com/joseluisq/static-web-server/commit/c383b8a). Upgrades also include a OpenSSL security upgrade to `1.1.1k` which fixes `CVE-2021-3450`. More details on https://www.openssl.org/news/secadv/20210325.txt


__Docs__

- [304288c]https://github.com/joseluisq/static-web-server/commit/304288c Minor README clarifications.

## v1.14.0 - 2021-02-14

__Features__

- [252406d]https://github.com/joseluisq/static-web-server/commit/252406d Binaries compiled with latest Rust [v1.50.0]https://blog.rust-lang.org/2021/02/11/Rust-1.50.0.html release.
- [feac82e]https://github.com/joseluisq/static-web-server/commit/feac82e Directory listing support via new `-i, --directory-listing` boolean flag (equivalent `SERVER_DIRECTORY_LISTING` env variable) which is disabled by default. PR [#32]https://github.com/joseluisq/static-web-server/pull/32 resolves [#31]https://github.com/joseluisq/static-web-server/issues/31.
- [5026bfe]https://github.com/joseluisq/static-web-server/commit/5026bfe Windows x86_64 binary support (.exe). See binary file attached to this release. PR [#33]https://github.com/joseluisq/static-web-server/pull/33 resolves [#29]https://github.com/joseluisq/static-web-server/issues/29.
- [116cbbf]https://github.com/joseluisq/static-web-server/commit/116cbbf UTF-8 URL decoding support (also [cfcb6c]https://github.com/joseluisq/static-web-server/commit/cfcb6c for directory listing)

__Refactorings__

- [4fe89c5]https://github.com/joseluisq/static-web-server/commit/4fe89c5 Trim CORS comma-separated allowed hosts (CORS server argument).
- [8733d2a]https://github.com/joseluisq/static-web-server/commit/8733d2a Simplify public example asset files.
- [1c1c2af]https://github.com/joseluisq/static-web-server/commit/1c1c2af Better 4xx/50x status code checks and more concise default error page content.
- [db51d77]https://github.com/joseluisq/static-web-server/commit/db51d77 `Option` type used for certain server arguments.
- [6551018]https://github.com/joseluisq/static-web-server/commit/6551018 Static file middleware searching optimizations which increases web server performance. 
- [a6cca08]https://github.com/joseluisq/static-web-server/commit/a6cca08 Improved static file path resolving.
- [5fed730]https://github.com/joseluisq/static-web-server/commit/5fed730 Improved error handling on directory listing feature.
- [d5e6bdd]https://github.com/joseluisq/static-web-server/commit/d5e6bdd Improve error handling on static files module.
- [b167030]https://github.com/joseluisq/static-web-server/commit/b167030 Optimize few dependencies features which reduces binary size.
- [dd59cd3]https://github.com/joseluisq/static-web-server/commit/dd59cd3 Explicit OS target for signals handling (just Unix-like & Windows distinction)

__Updates__

- [a664866]https://github.com/joseluisq/static-web-server/commit/a664866 Update dependencies 14.02.2021

__Codebase__

- [533006f]https://github.com/joseluisq/static-web-server/commit/533006f Refactor project modules structure & incorporate the static file middleware into the project.

__Docs__

- [6887624]https://github.com/joseluisq/static-web-server/commit/6887624 Remove whitespace description for CORS option.

## v1.13.0 - 2021-01-24

__Updates__

- [300337e]https://github.com/joseluisq/static-web-server/commit/300337e Update dependencies 24.01.2021 (also [a72b31d]https://github.com/joseluisq/static-web-server/commit/a72b31d)

__Features__

- __Github Sponsor support__. Consider to support this project via [Github Sponsor]https://github.com/sponsors/joseluisq  or Paypal [paypal.me/joseluisqs]https://paypal.me/joseluisqs.
- [63a05fa]https://github.com/joseluisq/static-web-server/commit/63a05fa HTTP to HTTPS redirection support. PR [#26]https://github.com/joseluisq/static-web-server/pull/26 resolves [#25]https://github.com/joseluisq/static-web-server/issues/25 by [@HenningHolmDE]https://github.com/HenningHolmDE. See [README]https://github.com/joseluisq/static-web-server/tree/1.x#environment-variables file for more details.
- [77b07be]https://github.com/joseluisq/static-web-server/commit/77b07be CLI argument aliases for some options. See [README]https://github.com/joseluisq/static-web-server/tree/1.x#command-line-arguments file for more details.

__Refactorings__

- [61d819d]https://github.com/joseluisq/static-web-server/commit/61d819d Minor server log info tweaks.
- [d595219]https://github.com/joseluisq/static-web-server/commit/d595219 Prefer `&[]` instead of `Vec` ptr as arg type for `on_server_running` function.

__Codebase__

- [f3008f3]https://github.com/joseluisq/static-web-server/commit/f3008f3 Github Actions as new CI.

## v1.12.0 - 2021-01-02

__Updates__

- [c3583f3]https://github.com/joseluisq/static-web-server/commit/c3583f3 Binaries compiled with latest Rust [v1.49.0]https://blog.rust-lang.org/2020/12/31/Rust-1.49.0.html release.
- [2732bd3]https://github.com/joseluisq/static-web-server/commit/2732bd3 Update dependencies 02.01.2021 (also [acef399]https://github.com/joseluisq/static-web-server/commit/acef399, [a7b3f40]https://github.com/joseluisq/static-web-server/commit/a7b3f40)

__Bug fixes__

- [c3583f3]https://github.com/joseluisq/static-web-server/commit/c3583f3 Server error response during large file downloads (Macos/Linux). Issue [#24]https://github.com/joseluisq/static-web-server/issues/24 reported by [@lukasa1993]https://github.com/lukasa1993.
The Rust 1.49.0 upgrade solves the issue which was [published on 1.48.0]https://github.com/rust-lang/rust/commit/db7ee7cc0ddf46a52f53a8a141cd0747f829999a

__Features__

- [62c8fc2]https://github.com/joseluisq/static-web-server/commit/62c8fc2 Alpine 1.12 Docker image.

__Darwin__

- Binary compiled on Mac OS X SDK 10.15 with a minimum 10.14 version. [joseluisq/rust-linux-darwin-builder@v1.49.0]https://github.com/joseluisq/rust-linux-darwin-builder/releases/tag/v1.49.0

__Binary sizes__

- **Linux:** Static binary size has no changed (__4.8M__) on current version `v1.12.0`.
- **Darwin:** Dynamic binary size was decreased (__0.1M__). From __1.7M__ (`v1.11.0`) to __1.6M__ (current version `v1.12.0`)

__Codebase__

- [7581c99]https://github.com/joseluisq/static-web-server/commit/7581c99 Ignore some project directories.

## v1.11.0 - 2020-10-15

__Updates__

- [d4e32ca]https://github.com/joseluisq/static-web-server/commit/d4e32ca Binaries compiled with latest Rust [v1.47.0]https://blog.rust-lang.org/2020/10/08/Rust-1.47.html release.
- [dd20c3e]https://github.com/joseluisq/static-web-server/commit/dd20c3e Update dependencies 15.10.2020 (also [d4e32ca]https://github.com/joseluisq/static-web-server/commit/d4e32ca, [c4db7c6]https://github.com/joseluisq/static-web-server/commit/c4db7c6)

__Improvements__

- [6d3dc45]https://github.com/joseluisq/static-web-server/commit/6d3dc45 Shrink Darwin binary size. 
- [2401b24]https://github.com/joseluisq/static-web-server/commit/2401b24 Include a `SERVER_VERSION` (server release version) env on every Docker image (also [ee47f76]https://github.com/joseluisq/static-web-server/commit/ee47f76, [74040cf]https://github.com/joseluisq/static-web-server/commit/74040cf).

__Binary sizes__

- **Linux:** Static binary size was increased (__0.5M__). From __4.3M__ (`v1.10.0`) to __4.8M__ (current version `v1.11.0`)
- **Darwin:** Dynamic binary size was decreased (__0.4M__). From __2.1M__ (`v1.10.0`) to __1.7M__ (current version `v1.11.0`)

__Codebase__

- [cbe1783]https://github.com/joseluisq/static-web-server/commit/cbe1783 Automate Docker images versioning with Drone pipelines.

## v1.10.0 - 2020-07-07

__Updates__

- [ff2f2ba]https://github.com/joseluisq/static-web-server/commit/ff2f2ba Binaries compiled with latest Rust [v1.44.1]https://blog.rust-lang.org/2020/06/18/Rust.1.44.1.html release.
- [9732d47]https://github.com/joseluisq/static-web-server/commit/9732d47 Update dependencies 07.07.2020 (also [eb30e11]https://github.com/joseluisq/static-web-server/commit/eb30e11)

__Improvements__

- [93aecf2]https://github.com/joseluisq/static-web-server/commit/93aecf2 Use `jemalloc` as global allocator on Linux Musl 64-bit systems. Which increases the web server performance (also [0fda53f]https://github.com/joseluisq/static-web-server/commit/0fda53f). See more details on PR [#22]https://github.com/joseluisq/static-web-server/pull/22.  

__Linux binary size__

Static binary size was increased (__0.2M__). From __4.1M__ (`v1.9.2`) to __4.3M__ (current version `v1.10.0`)

__Codebase__

- [8e5a3c7]https://github.com/joseluisq/static-web-server/commit/8e5a3c7 Refactor project dev structure.

## v1.9.2 - 2020-06-08

__Bugfixes__

- [034263e]https://github.com/joseluisq/static-web-server/commit/034263e Fix regression introduced by commit c0d2891 which displays wrong content type `text/plain` instead of `text/html` for 404/50x error pages.

## v1.9.1 - 2020-06-08

__Updates__

- [d87dafd]https://github.com/joseluisq/static-web-server/commit/d87dafd Binaries compiled with latest Rust [v1.43.1]https://blog.rust-lang.org/2020/05/07/Rust.1.43.1.html release.
- [0d7038f]https://github.com/joseluisq/static-web-server/commit/0d7038f Update dependencies 08.06.20 (also [044b4a9]https://github.com/joseluisq/static-web-server/commit/044b4a9)

__Improvements__

- Update `iron-staticfile-middleware` to [v0.4.2]https://github.com/joseluisq/iron-staticfile-middleware/releases/tag/v0.4.2 which increases slightly performance on every check of text-based mime types array.

__Refactors__

- [c0d2891]https://github.com/joseluisq/static-web-server/commit/c0d2891 Prefer `const` for the default content type on Error Page middeware.
- [c3a7d73]https://github.com/joseluisq/static-web-server/commit/c3a7d73 Minor syntax improvements on the Gzip middeware and the Staticfile handler.
- [f7564f6]https://github.com/joseluisq/static-web-server/commit/f7564f6 Remove unnecessary `to_string` conversion on server address.
- [23a6a15]https://github.com/joseluisq/static-web-server/commit/23a6a15 Remove git tag `latest` of release tag target.

## v1.9.0 - 2020-05-09

__Features__

-  Binaries compiled with latest Rust [v1.43.0]https://blog.rust-lang.org/2020/04/23/Rust-1.43.0.html and OpenSSL `v1.1.1g`. More details on [rust-linux-darwin-builder]https://github.com/joseluisq/rust-linux-darwin-builder/releases/tag/v1.43.0 release.
- [b2d2f40]https://github.com/joseluisq/static-web-server/commit/b2d2f40 Partial Content Delivery support. Which allows to serve bytes of large files. Resolves [#15]https://github.com/joseluisq/static-web-server/issues/15.
- [1af7d28]https://github.com/joseluisq/static-web-server/commit/1af7d28 CORS support via `--cors-allow-origins` option and its equivalent env. Resolves [#18]https://github.com/joseluisq/static-web-server/issues/18.
- [ed94c4b]https://github.com/joseluisq/static-web-server/commit/ed94c4b Enable Gzip compression only for known text-based file types. View file content types on issue [#19]https://github.com/joseluisq/static-web-server/issues/19.
- [77bf538]https://github.com/joseluisq/static-web-server/commit/77bf538 Update dependencies 10.05.2020 (also [b2d2f40]https://github.com/joseluisq/static-web-server/commit/b2d2f40, [7a0fed0]https://github.com/joseluisq/static-web-server/commit/7a0fed0)

__Linux binary size__

Static binary size was increased (__0.1M__). From __4.0M__ (`v1.8.0`) to __4.1M__ (current version `v1.9.0`)


__Documentation__

- [e37d513]https://github.com/joseluisq/static-web-server/commit/e37d513 Corresponding documentation updates reflecting changes and features.

__Codebase__

- [1b1174d]https://github.com/joseluisq/static-web-server/commit/1b1174d Prefer const over static on default error page content.
- [4bda5f3]https://github.com/joseluisq/static-web-server/commit/4bda5f3 Simplify Gzip middleware.
- [9a109d7]https://github.com/joseluisq/static-web-server/commit/9a109d7 Staging CI pipeline.

## v1.8.0 - 2020-04-21

__Overview__

This minor release `v1.8.0` introduces the following:

- `assets` directory path configurable and independent (no more relative to the `root`). This contains a **"breaking change"**. (Please see below).
- `assets` directory route is always the directory name. That means if you have `/public/my-assets` then the route will be `/my-assets`. 
- New option for configurable logging levels. `error` log level by default. (More details below).
* Reply with an empty response body on HEAD requests.
* Skip Gzip compression on HEAD requests.
* `root` and `assets` directory paths checking before to start the server.
* Improve logging server information.

Please view the details involved about this minor release.

__Features__

* [2f7d042]https://github.com/joseluisq/static-web-server/commit/2f7d042 - Configurable assets directory. (minor breaking change).
* [0dd2abe]https://github.com/joseluisq/static-web-server/commit/0dd2abe - Configurable logging levels (resolves [#16]https://github.com/joseluisq/static-web-server/issues/16) via `--log-level` option or its equivalent env. Now `error` log level is enabled by default. Use `info` level if you want requests details. Check out the documentation for more options.
* [0a9f66b]https://github.com/joseluisq/static-web-server/commit/0a9f66b - Update [`iron_staticfile_middleware`]https://github.com/joseluisq/iron-staticfile-middleware to `v0.3.0`.
* [925c58a]https://github.com/joseluisq/static-web-server/commit/925c58a - Update dependencies (April 21th 2020).

__Breaking change__

This minor release contains one "breaking change" due to the feature _"configurable assets directory"_ ([2f7d042]https://github.com/joseluisq/static-web-server/commit/2f7d042).

__1. Configurable assets directory__

This feature makes `assets` directory (`--assets` option and its equivalent `SERVER_ASSETS` env) configurable and independent.

It means that `assets` directory is no more restricted to be relative to `root` directory. So absolute `paths` work now.

__1.1. Caveat and solution for relative assets directory__

If you are using an `assets` directory path relative to `root` (`v1.7.0` or early). For example if you have a root `./my-root` and assets `./my-assets`  directories. Just adjust your `assets` directory path to `./my-root/my-assets` or use another absolute path if you want.

This is necessary because from now, the `assets` directory is treated as an independent path. So an absolute path is recomendable for both directories (root and assets).

Otherwise, if you are using the default values provided by the server, you don't need to modify anything. Unless you had specified them yourself. If so, please proceed as explained above.

__Refactorings__

* [59777d7]https://github.com/joseluisq/static-web-server/commit/59777d7 - Empty response body on HEAD requests (also 07bf49b).
* [57184a5]https://github.com/joseluisq/static-web-server/commit/57184a5 - Skip Gzip compression on HEAD requests.
* [e40016d]https://github.com/joseluisq/static-web-server/commit/e40016d - Root and assets directory paths checking.
* [597fa97]https://github.com/joseluisq/static-web-server/commit/597fa97 - Improve logging server information.

__Documentation__

New options and modifications details were updated, please take a look the documentation on README file.

* [8a5cf79]https://github.com/joseluisq/static-web-server/commit/8a5cf79 - Clarify assets default option value.
* [0767071]https://github.com/joseluisq/static-web-server/commit/0767071 - Docker stack notes about assets directory functionality.

__Codebase__

* [a449eb3]https://github.com/joseluisq/static-web-server/commit/a449eb3 - Refactor path helpers implementation.
* [2e2a6ac]https://github.com/joseluisq/static-web-server/commit/2e2a6ac - Simplify error page implementation.
* [ff4ec6e]https://github.com/joseluisq/static-web-server/commit/ff4ec6e - Static file unit test cases.
* [48b92ef]https://github.com/joseluisq/static-web-server/commit/48b92ef - Skip files of Docker build context.

## v1.7.0 - 2020-04-04

__Features__

- [052c18d]https://github.com/joseluisq/static-web-server/commit/052c18d Binaries compiled with latest Rust [v1.42.0]https://blog.rust-lang.org/2020/03/12/Rust-1.42.html
- [4ae5b1a]https://github.com/joseluisq/static-web-server/commit/4ae5b1a Update dependencies (April 4th 2020)

__Linux binary size__

Static binary size was increased (__0.1M__). From __3.9M__ (`v1.6.0`) to __4.0M__ (current version `v1.7.0`)

__Codebase__
- [18a6cd5]https://github.com/joseluisq/static-web-server/commit/18a6cd5 - Simplify makefile build tagets. Includes checksum task (also [1c3abdf]https://github.com/joseluisq/static-web-server/commit/1c3abdf)
- Among other project structural improvements

## v1.6.0 - 2020-03-04

__Features__

- [d0e7a7f]https://github.com/joseluisq/static-web-server/commit/d0e7a7f Binaries compiled with latest Rust [v1.41.1]https://blog.rust-lang.org/2020/02/27/Rust-1.41.1.html.
- [a2a4e98]https://github.com/joseluisq/static-web-server/commit/a2a4e98 Signals termination support. View feature issue  [#13]https://github.com/joseluisq/static-web-server/issues/13 resolved by PR [#14]https://github.com/joseluisq/static-web-server/pull/14.
- [08d5847]https://github.com/joseluisq/static-web-server/commit/08d5847 Docker Alpine image upgraded to latest `v3.11`.
- [20b9fd2]https://github.com/joseluisq/static-web-server/commit/20b9fd2 Docker entrypoint shell script for Alpine image. It gives the ability to pass flag arguments on a `docker run` execution or via the `command` option in a `docker-compose` file. Example: `docker run --rm static-web-server:alpine --help`. Flag arguments (with dashes) will be passed to `static-web-server`, otherwise they will be treated as shell commands. Example of an interactive run: `docker run --rm -it static-web-server:alpine sh`.
- [881f37c]https://github.com/joseluisq/static-web-server/commit/881f37c Dependency updates 03.03.2020. (also [a96e031]https://github.com/joseluisq/static-web-server/commit/a96e031, [c0e96e8]https://github.com/joseluisq/static-web-server/commit/c0e96e8)

__Linux binary size__

Static binary size was reduced (__0.3M__). From __4.2M__ (`v1.5.0`) to __3.9M__ (current version `v1.6.0`)


__Codebase__

- [bac3914]https://github.com/joseluisq/static-web-server/commit/bac3914 `openssl` as dev-dependency vendored.
- [27dd9ff]https://github.com/joseluisq/static-web-server/commit/27dd9ff Update makefile cross-compiling tasks using `rust-linux-darwin-builder` (also [38808fb]https://github.com/joseluisq/static-web-server/commit/38808fb).
- [478d100]https://github.com/joseluisq/static-web-server/commit/478d100 Rename Docker file templates. (also [ba105e4]https://github.com/joseluisq/static-web-server/commit/ba105e4)
- [2adc5db]https://github.com/joseluisq/static-web-server/commit/2adc5db Relocate Docker templates version script.
- [34e0c59]https://github.com/joseluisq/static-web-server/commit/34e0c59 Minor documentation updates.


## v1.5.0 - 2020-02-02

__Features__

- [6dc5056]https://github.com/joseluisq/static-web-server/commit/6dc5056 Feat: gzip compression on demand via `accept-encoding` header (PR [#12]https://github.com/joseluisq/static-web-server/pull/12 resolves [#10]https://github.com/joseluisq/static-web-server/issues/10). 
- [eaebf82]https://github.com/joseluisq/static-web-server/commit/eaebf82 Feat: Update dependencies Feb 02, 2020. It also resolves [#11]https://github.com/joseluisq/static-web-server/issues/11 `head` request method feature.
- 
## v1.4.0 - 2020-01-15

__Features__

- [d195e74]https://github.com/joseluisq/static-web-server/commit/d195e74 Feat: Add TLS/SSL support (PR [#9]https://github.com/joseluisq/static-web-server/pull/9 resolves [#2]https://github.com/joseluisq/static-web-server/issues/2).  Introducing three new options such as `--tls`, `--tls-pkcs12` and `--tls-pkcs12-passwd` as well as their corresponding environment variables.
- [63f2c82]https://github.com/joseluisq/static-web-server/commit/63f2c82 Docs: Add TLS/SSL section. View [usage]https://github.com/joseluisq/static-web-server#usage on readme file.
- [9c58c9c]https://github.com/joseluisq/static-web-server/commit/9c58c9c Feat: Update to latest dependencies Jun 15, 2020.
- Due TLS/SSL feature the __Linux__ binary size has incremented (`2,3MB`) from `1.8MB` to `4.1MB`.

__Misc__

- [cf0fb53]https://github.com/joseluisq/static-web-server/commit/cf0fb53 Docs: Update new options usage in readme file
- [a7d55ad]https://github.com/joseluisq/static-web-server/commit/a7d55ad Fix: Permissions for Rust project directory
- [86f8d8a]https://github.com/joseluisq/static-web-server/commit/86f8d8a Feat: Add more sections to Cargo manifest file

## v1.3.0 - 2020-01-07

__Features__

- [9179bc3]https://github.com/joseluisq/static-web-server/commit/9179bc3 Add binary support for __Macos__ `x86_64-apple-darwin` thanks to [Rust Linux / Darwin Builder]https://github.com/joseluisq/rust-linux-darwin-builder. Resolves issue [#8]https://github.com/joseluisq/static-web-server/issues/8.
- [1509f5f]https://github.com/joseluisq/static-web-server/commit/1509f5f Update dependencies Jan 7, 2020

__Misc__

- [92b04e1]https://github.com/joseluisq/static-web-server/commit/92b04e1 Add Linux and Darwin makefile tasks
- [a7a6d61]https://github.com/joseluisq/static-web-server/commit/a7a6d61 Fix tarball and shrinking makefile tasks
- [56c425a]https://github.com/joseluisq/static-web-server/commit/56c425a Remove Github release step from Drone pipeline

## v1.2.0 - 2019-12-26

__Features__

-  [2979f7a]https://github.com/joseluisq/static-web-server/commit/2979f7a Makes optional the _**error pages feature**_ introducing default response HTML messages for 400 and 50x errors. (PR [#7]https://github.com/joseluisq/static-web-server/pull/7 resolves [#6]https://github.com/joseluisq/static-web-server/issues/6) 

__Refactors__

- [8a90486]https://github.com/joseluisq/static-web-server/commit/8a90486 Update pages and assets example
- [3e64cbb]https://github.com/joseluisq/static-web-server/commit/3e64cbb Update server config information

__Misc__

- [593ca98]https://github.com/joseluisq/static-web-server/commit/593ca98 Minor documentation updates
- [9f63108]https://github.com/joseluisq/static-web-server/commit/9f63108 Disable Travis CI email notifications

## v1.1.0 - 2019-12-25

__Features__

- Rust [v1.40.0]https://blog.rust-lang.org/2019/12/19/Rust-1.40.0.html ([73528e3]https://github.com/joseluisq/static-web-server/commit/73528e3 2019-12-16)
- CLI options support. PR [#4]https://github.com/joseluisq/static-web-server/pull/4 by [@dlalic]https://github.com/dlalic resolves [#1]https://github.com/joseluisq/static-web-server/issues/1. See README file for more details.
- Error pages support. PR [#5]https://github.com/joseluisq/static-web-server/pull/5 resolves [#3]https://github.com/joseluisq/static-web-server/issues/3. See README file for more details.
- Binary size increment (`0.4MB`) from `1.4MB` to `1.8MB`.

__Breaking changes__

Due __error HTML pages feature #5__ now the server requires two settings for display 404 and 50x errors.

For example if you use environment variables try to append following variables with the two paths of your HTML pages:

```sh
#  HTML file path for 404 errors
SERVER_ERROR_PAGE_404=./public/404.html
# HTML file path for 50x errors
SERVER_ERROR_PAGE_50X=./public/50x.html
```

Or via CLI options:

```
--page404 <page404>    HTML file path for 404 errors [env: SERVER_ERROR_PAGE_404=]  [default: ./public/404.html]
--page50x <page50x>    HTML file path for 50x errors [env: SERVER_ERROR_PAGE_50X=]  [default: ./public/50x.html]
```

__Refactors__
- [112a1f3]https://github.com/joseluisq/static-web-server/commit/112a1f3 Update dockefile templates metadata
- [b34624c]https://github.com/joseluisq/static-web-server/commit/b34624c Dependency updates 
- [5e9abd4]https://github.com/joseluisq/static-web-server/commit/5e9abd4 Apply cargo fix --edition to entire project 
- [4712b9c]https://github.com/joseluisq/static-web-server/commit/4712b9c Minor tweaks for Cargo make tasks
- [6fb65b2]https://github.com/joseluisq/static-web-server/commit/6fb65b2 Rename `env.rs` to `config.rs`.
- New updated fork dependency [iron-staticfile-middleware]https://github.com/joseluisq/iron-staticfile-middleware
- Minor project code base improvements

## v1.0.0 - 2019-11-28

This is the first major release :zap:

__Features__

- Rust [v1.39.0]https://blog.rust-lang.org/2019/11/07/Rust-1.39.0.html ([4560ea788]https://github.com/joseluisq/static-web-server/commit/4560ea788 2019-11-04)
- Binary size reduction for this current release from `1.6MB` to `1.4MB`.

## v1.0.0-beta.4 - 2019-11-28

__Updates__

- [eb96054]https://github.com/joseluisq/static-web-server/commit/eb96054 Refactor project structure
- [eb96054]https://github.com/joseluisq/static-web-server/commit/eb96054 Update dependencies
- [eb96054]https://github.com/joseluisq/static-web-server/commit/eb96054 Support for latest Rust [v1.39.0]https://blog.rust-lang.org/2019/11/07/Rust-1.39.0.html (`[4560ea7](https://github.com/joseluisq/static-web-server/commit/4560ea7)` 2019-11-04)

__Deployment__

- [2fd780e]https://github.com/joseluisq/static-web-server/commit/2fd780e Fix Cargo package config file name and version extraction 
- [3a69088]https://github.com/joseluisq/static-web-server/commit/3a69088 Fix release tarball files generation

__Misc__

- Binary size reduction for this current release from `1.6M` to `1.4M`.

## v1.0.0-beta.3 - 2019-10-10
__Features__

- Add [Rust v1.38.0]https://blog.rust-lang.org/2019/09/26/Rust-1.38.0.html ([625451e]https://github.com/joseluisq/static-web-server/commit/625451e 2019-09-23) compiling support.

## v1.0.0-beta.2 - 2019-09-05
diff --git a/docs/changelog-v2.md b/docs/changelog-v2.md
new file mode 100644
index 0000000..273a1a9
--- /dev/null
+++ b/docs/changelog-v2.md
@@ -0,0 +1,370 @@
# Static Web Server v2 - Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog]https://keepachangelog.com/en/1.0.0/,
and this project adheres to [Semantic Versioning]https://semver.org/spec/v2.0.0.html.

_**Note:** See changelog for v1 under the [1.x]https://github.com/joseluisq/static-web-server/blob/1.x/CHANGELOG.md branch._

## v2.1.0 - 2021-10-23

__Fixes__

* [5f3842b]https://github.com/joseluisq/static-web-server/commit/5f3842b Update dependencies including Hyper, Tokio, h2, futures, tracing bug/security fixes and related crates (also [5528bcb]https://github.com/joseluisq/static-web-server/commit/5528bcb, [dc98fbb]https://github.com/joseluisq/static-web-server/commit/dc98fbb).
* [62e98c6]https://github.com/joseluisq/static-web-server/commit/62e98c6 `aarch64-unknown-linux-musl` build fails using Rust nightly.

__Features__

- [abc76a8]https://github.com/joseluisq/static-web-server/commit/abc76a8 Basic HTTP Authentication support via the new `--basic-auth` option. PR [#55]https://github.com/joseluisq/static-web-server/pull/55 resolves [#53]https://github.com/joseluisq/static-web-server/issues/53 suggested by [@bjornharrtell]https://github.com/bjornharrtell.

__Refactorings__

- [0273611]https://github.com/joseluisq/static-web-server/commit/0273611 Prefer `futures-util` over `futures` dependency.
- [c3bfa68]https://github.com/joseluisq/static-web-server/commit/c3bfa68 Use [Rust 1.56.0 (2021 Edition)]https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html on CI.

__Docs__

- [f89c5c9]https://github.com/joseluisq/static-web-server/commit/f89c5c9 Describe Basic HTTP Authentication feature.
- [a6d0e53]https://github.com/joseluisq/static-web-server/commit/a6d0e53 Minor general description improvements.

## v2.0.3 - 2021-09-29

__Fixes__

* [5de5874]https://github.com/joseluisq/static-web-server/commit/5de5874 Update dependencies including Hyper, Tokio, http, futures, tracing bug fixes and related crates (also [1c6c873]https://github.com/joseluisq/static-web-server/commit/1c6c873 [34efa49]https://github.com/joseluisq/static-web-server/commit/34efa49, [6fb832b]https://github.com/joseluisq/static-web-server/commit/6fb832b)

__Refactorings__

- [b2f09ab]https://github.com/joseluisq/static-web-server/commit/b2f09ab Remove optional extra Docker volume `/public` of `scratch` and `alpine` images. PR [#52]https://github.com/joseluisq/static-web-server/pull/52 resolves [#51]https://github.com/joseluisq/static-web-server/issues/51 reported by [@bergi9]https://github.com/bergi9.
- [906106f]https://github.com/joseluisq/static-web-server/commit/906106f Remove never read `origins_str` field on Cors module.
- [6f7a6bc]https://github.com/joseluisq/static-web-server/commit/6f7a6bc Fix Rust edition idioms.

__Tests__

* [166e869]https://github.com/joseluisq/static-web-server/commit/166e869 More Cors test cases.

## v2.0.2 - 2021-08-29

__Fixes__

* [ab83e2a]https://github.com/joseluisq/static-web-server/commit/ab83e2a Update dependencies including Hyper, h2, httparse bug fixes. Tokio leak fix and related crates (also [adb8ca6]https://github.com/joseluisq/static-web-server/commit/adb8ca6)

## v2.0.1 - 2021-08-18

__Fixes__

* [2459ec4]https://github.com/joseluisq/static-web-server/commit/2459ec4 Return incorrect first bytes range when final bytes are requested. For example a request using `Range: bytes=-10` header returned incorrectly the first 10 bytes rather than the last 10 ones.

__Updates__

* [122e1bd]https://github.com/joseluisq/static-web-server/commit/122e1bd Update dependencies including Hyper and Tokio bug fixes, Brotli, Serde and related crates (also [0b413f9]https://github.com/joseluisq/static-web-server/commit/0b413f9, [fa130fa]https://github.com/joseluisq/static-web-server/commit/fa130fa, [167e1de]https://github.com/joseluisq/static-web-server/commit/167e1de, [fa32375]https://github.com/joseluisq/static-web-server/commit/fa32375, [2d1c5f3]https://github.com/joseluisq/static-web-server/commit/2d1c5f3)

__Refactorings__

* [8fc1812]https://github.com/joseluisq/static-web-server/commit/8fc1812 Remove needless borrow on static file and handle modules.
* [27f5687]https://github.com/joseluisq/static-web-server/commit/27f5687 UTF-8 for default Docker `index.html` file.
* [ffb2e54]https://github.com/joseluisq/static-web-server/commit/ffb2e54 Update Rust stable to 1.54.0 on CI.

__Tests__

* [5cdcffc]https://github.com/joseluisq/static-web-server/commit/5cdcffc More directory listing test cases.
* [c7e8ec9]https://github.com/joseluisq/static-web-server/commit/c7e8ec9 More static files test cases.
* [37f2371]https://github.com/joseluisq/static-web-server/commit/37f2371 More static file methods and compression test cases.
* [dd7f995]https://github.com/joseluisq/static-web-server/commit/dd7f995 More static file test cases for during request handling.

__Docs__

* [f389cbc]https://github.com/joseluisq/static-web-server/commit/f389cbc Minor badges and link updates.

## v2.0.0 - 2021-07-18

The second major stable release is finally available after around half a year of work. It introduces notable changes including new features, performance improvements and new targets support like ARM64 and OSes like FreeBSD.

This version was re-written almost from scratch on top of [Hyper]https://github.com/hyperium/hyper and [Tokio]https://github.com/tokio-rs/tokio runtime which give us the [Rust asynchronous ability]https://rust-lang.github.io/async-book/01_getting_started/02_why_async.html by default and latest HTTP/1 - HTTP/2 implementation improvements.
However it still try to keep the same principles of its first version: lightness and easy to use. Therefore a migration should not be a big deal.

Your feedback is very appreciated.

### Features

This list only shows new features not present in previous v1.

- Static Web Server is now asynchronous by default powered by latest Hyper and Tokio.
- It supports opt-in GZip, Deflate and Brotli compression for text-based web files only.
- HTTP/2 + TLS support (via `--http2` option).
- [Security headers]https://github.com/joseluisq/static-web-server/pull/44 like STS, CSP and others for HTTP/2 by default.
- Customizable number of worker threads (via `--threads-multiplier` option).
- [Redesigned directory listing]https://github.com/joseluisq/static-web-server/pull/41 (via `--directory-listing` option).
- Cache control header is now optional (via `--cache-control-headers`).
- Ability to accept a socket listener as a file descriptor for use in sandboxing and on-demand applications (E.g [systemd]http://0pointer.de/blog/projects/socket-activation.html). Via `--fd` option. Thanks to [@tim-seoss]https://github.com/tim-seoss.
- Binaries for various i686/x86_64 targets (Linux/Windows/FreeBSD) and ARM/ARM64 (Linux/Macos M1)

For the full list, options details and usage please check it out the [README]./README.md file.

### Breaking changes

This major version has few breaking changes.
However a migration should not represent a problem. Please have in mind the following changes:

- The server supports now only a root directory path (via `--root` or its equivalent env) so an assets path option is no longer required.
- Cache control headers is applied to assets in an arbitrary manner. See [src/control_headers.rs]src/control_headers.rs for more details.
- OpenSSL TLS for HTTP/1 is not longer supported instead for the HTTP/2 + TLS (via `--http2` option) the server uses [h2]https://github.com/hyperium/h2 which is on top of [Rustls]https://github.com/ctz/rustls. It means that instead of using a .p12 or .pfx file you can now use only a certificate file along with its private key. More details on [README]./README.md file.

The rest of known options are equivalent to v1 except the new ones of course.
However it's worth to always recommend to test this server update first with your applications on a development environment or similar.

Please see the full list of options with their details on the [README]./README.md file.

---

Changes after the latest `v2.0.0-beta.7` release:

__Performance__

- [157ade1]https://github.com/joseluisq/static-web-server/commit/157ade1 Decrease few allocations during 404/50x error page responses.
- [941572c]https://github.com/joseluisq/static-web-server/commit/941572c Reduce few allocations on control headers checking.

__Features__

- [012b626]https://github.com/joseluisq/static-web-server/commit/012b626 Cache control headers optional via `--cache-control-headers`.

__Refactorings__

- [5aa587f]https://github.com/joseluisq/static-web-server/commit/5aa587f Minor syntax improvements on static file module.
- [45988db]https://github.com/joseluisq/static-web-server/commit/45988db Minor style updates on server module.

__Docs__

- [5bcc629]https://github.com/joseluisq/static-web-server/commit/5bcc629 FreeBSD targets description.
- [dffdf5c]https://github.com/joseluisq/static-web-server/commit/dffdf5c Changelog support.

## v2.0.0-beta.7 - 2021-07-09

Seventh and last beta release `v2.0.0-beta.7` with notable changes.

__Updates__

- [9e90b38]https://github.com/joseluisq/static-web-server/commit/9e90b38 Hyper 0.14.10 dependency update which fixes two [security issues]https://github.com/hyperium/hyper/releases/tag/v0.14.10.

__Features__

- [432b591]https://github.com/joseluisq/static-web-server/commit/432b591 FreeBSD i686 and x86_64 targets support.
  - i686-unknown-freebsd
  - x86_64-unknown-freebsd

Find the binaries for new targets attached to this release.

__Performance__

- [70a76ed]https://github.com/joseluisq/static-web-server/commit/70a76ed Optimize root path of static file module which increases performance and reduces memory usage.

__Codebase__

- [2aa130d]https://github.com/joseluisq/static-web-server/commit/2aa130d Move source `./public` to `./docker` dir.

## v2.0.0-beta.6 - 2021-07-07

Sixth beta release `v2.0.0-beta.6` with notable changes.

__Updates__

- [33040d0]https://github.com/joseluisq/static-web-server/commit/33040d0 Update dependencies including latest Tokio and related crates (also [a4ef322]https://github.com/joseluisq/static-web-server/commit/a4ef322, [26b3fbc]https://github.com/joseluisq/static-web-server/commit/26b3fbc, [e07c333]https://github.com/joseluisq/static-web-server/commit/e07c333).

__Fixes__

- [a1b7836]https://github.com/joseluisq/static-web-server/commit/a1b7836 Missing `Content-Type` header for directory listing index and error pages.

__Features__

- [e2bf778]https://github.com/joseluisq/static-web-server/commit/e2bf778 Windows 64-bit target support. It also improves Ctrl+C signal handling cross-platform. Note Windows ARM64 is in stand by temporarily, see README file for more details.
- [0fa5015]https://github.com/joseluisq/static-web-server/commit/0fa5015 Windows/Linux i686 targets support and one Windows x86_64
  - i686-pc-windows-msvc
  - i686-unknown-linux-gnu
  - i686-unknown-linux-musl
  - x86_64-pc-windows-gnu
- [59cf8bc]https://github.com/joseluisq/static-web-server/commit/59cf8bc More text-based mime types for compression.
  - text/csv
  - text/calendar
  - text/markdown
  - text/x-yaml
  - text/x-toml
  - application/rtf
  - application/xhtml+xml

Find the binaries for new targets attached to this release and all targets supported also described in the README file.

__Refactorings__

- [2a699e4]https://github.com/joseluisq/static-web-server/commit/2a699e4 Follow symlinks during directory listing, displaying the index page properly for symlinks that points to directories or files.
- [b4f1bcc]https://github.com/joseluisq/static-web-server/commit/b4f1bcc Prefer stabilized `Poll::map_err` on compression stream.
- [55ffd06]https://github.com/joseluisq/static-web-server/commit/55ffd06 Handle potencial panic for 404/50x error page responses.
- [920acb2]https://github.com/joseluisq/static-web-server/commit/920acb2 Prefer `to_owned()` for string literals over `to_string()` in some cases.
- [c0dca6e]https://github.com/joseluisq/static-web-server/commit/c0dca6e Improve directory path scanning when directory listing.
- [0ed6287]https://github.com/joseluisq/static-web-server/commit/0ed6287 Auto compression error result logging.
- [87b8744]https://github.com/joseluisq/static-web-server/commit/87b8744 Minor server config info updates.
- [b025536]https://github.com/joseluisq/static-web-server/commit/b025536 Minor code styling and docs changes.

__Release notes__ 

FreeBSD i686/x86_64 binaries are coming in next and last beta release which is very close to the final v2 releasing.

## v2.0.0-beta.5 - 2021-06-22

Fifth beta release `v2.0.0-beta.5` with notable changes.

__Updates__

- [5343a22]https://github.com/joseluisq/static-web-server/commit/5343a22 Update dependencies including latest Hyper, Tokio and related crates. (also [bcb8493]https://github.com/joseluisq/static-web-server/commit/bcb8493, [e51f969]https://github.com/joseluisq/static-web-server/commit/e51f969, [e51f969]https://github.com/joseluisq/static-web-server/commit/e51f969)

__Features__

- [c96af53]https://github.com/joseluisq/static-web-server/commit/c96af53 Security headers for HTTP/2 by default (`--security-headers`). PR [#44]https://github.com/joseluisq/static-web-server/pull/44 resolves [#39]https://github.com/joseluisq/static-web-server/issues/39
- [3c95d1a]https://github.com/joseluisq/static-web-server/commit/3c95d1a Support five more targets. (also [e6faff8]https://github.com/joseluisq/static-web-server/commit/e6faff8)
  - `x86_64-unknown-linux-gnu`
  - `aarch64-apple-darwin`
  - `aarch64-unknown-linux-gnu`
  - `aarch64-unknown-linux-musl`
  - `arm-unknown-linux-gnueabihf`

Find binaries for those targets attached to this release.

__Note about releases__

[Rust Nightly]https://doc.rust-lang.org/book/appendix-07-nightly-rust.html is powering the releases from now on the CI. This makes possible to reach more targets in the future.
For more details about it see [Rust Nightly targets supported]https://doc.rust-lang.org/nightly/rustc/platform-support.html.
However clarify that the `static-web-server` project is not using any nightly feature but only _**stable Rust**_ ones and the project is also tested against nightly and stable Rust on CI periodically in order to be notified in case of _"regressions or bugs introduced in Nightly Rust"_. However it is [known]https://stackoverflow.com/a/56067977/2510591 that the nightly compiler is very stable therefore the reason why we have chosen it for release targets via CI like many other popular Rust projects.
In any case, please don't hesitate to file an issue or send a PR.

__Refactorings__

- [2b2da3a]https://github.com/joseluisq/static-web-server/commit/2b2da3a `--http2-tls-cert` and `--http2-tls-key` options now require `--http2` enabled.
- [6fe04a5]https://github.com/joseluisq/static-web-server/commit/6fe04a5 Update Docker files in order to get the new Linux binary source.
- [77d231c]https://github.com/joseluisq/static-web-server/commit/77d231c Drop redudant reference on CORS module.
- [d5189ec]https://github.com/joseluisq/static-web-server/commit/d5189ec Drop root arc-path on static files module.

## v2.0.0-beta.4 - 2021-06-02

Fourth beta release `v2.0.0-beta.4` with notable changes.

__Updates__

- [a8b9379]https://github.com/joseluisq/static-web-server/commit/a8b9379 Binaries compiled with latest Rust [1.52.1]https://blog.rust-lang.org/2021/05/10/Rust-1.52.1.html release.
- [c3389cc]https://github.com/joseluisq/static-web-server/commit/c3389cc Update dependencies including latest Hyper, Tokio and related crates. (also [7cbe483]https://github.com/joseluisq/static-web-server/commit/7cbe483)

__Features__

- [21bdf8c]https://github.com/joseluisq/static-web-server/commit/21bdf8c Support inheriting TCP listener from parent process via file descriptor (`-f`, `--fd`). PR [#40]https://github.com/joseluisq/static-web-server/pull/40 by [@tim-seoss]https://github.com/tim-seoss.
- [5428eb3]https://github.com/joseluisq/static-web-server/commit/5428eb3 Redefined directory listing (`-z`, `--directory-listing`). PR [#41]https://github.com/joseluisq/static-web-server/pull/41
- [d389803]https://github.com/joseluisq/static-web-server/commit/d389803 Opt-in response body auto compression (Gzip, Deflate, Brotli) based on `Accept-Encoding` header (`-x`, `--compression`).
- [74b9eaf]https://github.com/joseluisq/static-web-server/commit/74b9eaf Just one file associated metadata per request as possible.
- [af9a329]https://github.com/joseluisq/static-web-server/commit/af9a329 CORS support (`-c`, ` --cors-allow-origins`).
- [6ed3fe5]https://github.com/joseluisq/static-web-server/commit/6ed3fe5 Unix-like termination signals handling.

__Refactorings__

- [a8d462a]https://github.com/joseluisq/static-web-server/commit/a8d462a Drop `Warp` in favor of just `Hyper` + `Tokio`. PR [#38]https://github.com/joseluisq/static-web-server/pull/38
- [04ec1b1]https://github.com/joseluisq/static-web-server/commit/04ec1b1 One worker thread per available core by default (`-n`, `--threads-multiplier`).
- [991d4b8]https://github.com/joseluisq/static-web-server/commit/991d4b8 Introduce a custom Hyper service implementation for the HTTP1 & HTTP2 web servers.
- [58ff9b7]https://github.com/joseluisq/static-web-server/commit/58ff9b7 Reject non `HEAD` or `GET` requests on static assets and error page handlers.
- [5cede7e]https://github.com/joseluisq/static-web-server/commit/5cede7e Log info for compression and directory listing features.

__Docs__

All feature flags as well as their equivalent environment variables are described on the updated [README]https://github.com/joseluisq/static-web-server#usage file.

## v2.0.0-beta.3 - 2021-04-20

Third beta release `v2.0.0-beta.3` with notable changes.

__Updates__

- [7f29c90]https://github.com/joseluisq/static-web-server/commit/7f29c90 Binaries compiled with latest Rust [1.51.0]https://blog.rust-lang.org/2021/03/25/Rust-1.51.0.html release.
- [97d75e0]https://github.com/joseluisq/static-web-server/commit/97d75e0 [Alpine 3.13]https://alpinelinux.org/posts/Alpine-3.13.0-released.html Docker image.
- [97d75e0]https://github.com/joseluisq/static-web-server/commit/97d75e0 Update dependencies including latest **Tokio** `v1`,  **Warp** `v0.3` (with **Hyper** `v0.14`) and related crates (also [e9384e9]https://github.com/joseluisq/static-web-server/commit/e9384e9, [5d4421d]https://github.com/joseluisq/static-web-server/commit/5d4421d)

__Refactorings__

- [5d8b266]https://github.com/joseluisq/static-web-server/commit/5d8b266 Static server configuration and static default error pages content.
- [e853410]https://github.com/joseluisq/static-web-server/commit/e853410 Drop support for Deflate compression.
- [bbb5a8f]https://github.com/joseluisq/static-web-server/commit/bbb5a8f Improve log information on server runtime setup.
- [c05471f]https://github.com/joseluisq/static-web-server/commit/c05471f Tokio server tasks simplifications.
- [7ea40a7]https://github.com/joseluisq/static-web-server/commit/7ea40a7 Minor CLI typos.

__Fixes__

- [99b8b7e]https://github.com/joseluisq/static-web-server/commit/99b8b7e Linking error for `ring` crate during Darwin build.

__Docs__

- [3c36c9b]https://github.com/joseluisq/static-web-server/commit/3c36c9b Minor README description improvements.

## v2.0.0-beta.2 - 2021-01-30

Second beta release `v2.0.0-beta.2` with notable changes.

__Updates__

- [9867d71]https://github.com/joseluisq/static-web-server/commit/9867d71 Update dependencies including latest **Tokio** `v1`,  **Warp** `v0.3` (with **Hyper** `v0.14`) and related crates. (also [a4421c6]https://github.com/joseluisq/static-web-server/commit/a4421c6, [960a681]https://github.com/joseluisq/static-web-server/commit/960a681, [960a681]https://github.com/joseluisq/static-web-server/commit/960a681)

__Features__

- [3007e74]https://github.com/joseluisq/static-web-server/commit/3007e74 **Project sponsor support.** Consider to support the project via [github.com/sponsors/joseluisq]https://github.com/sponsors/joseluisq or [paypal.me/joseluisqs]https://paypal.me/joseluisqs.
- [360ae99]https://github.com/joseluisq/static-web-server/commit/360ae99 Worker threads multiplier option `--threads-multiplier` which provides the ability to customize number of worker threads.
- [ed0d6ac]https://github.com/joseluisq/static-web-server/commit/ed0d6ac Custom error pages support.
- [4667b10]https://github.com/joseluisq/static-web-server/commit/4667b10 HTTP/2 + TLS support.
- [8c4ce94]https://github.com/joseluisq/static-web-server/commit/8c4ce94 CORS support.

More details about features on [README]https://github.com/joseluisq/static-web-server/ file.

__Refactorings__

- [6d3e2d1]https://github.com/joseluisq/static-web-server/commit/6d3e2d1 Remove redundant `'static` lifetime on constants.
- [866c7cd]https://github.com/joseluisq/static-web-server/commit/866c7cd Remove Tokio `macros` feature.
- [f7f2bf6]https://github.com/joseluisq/static-web-server/commit/f7f2bf6 Some improvement suggestions by `Clippy`.
- [bff49a0]https://github.com/joseluisq/static-web-server/commit/bff49a0 Few improvement on filter and helper modules.

__Codebase__

- [7265f6b]https://github.com/joseluisq/static-web-server/commit/7265f6b Github Actions as new CI.
- [c63b549]https://github.com/joseluisq/static-web-server/commit/c63b549 Remove Travis CI.
- [65250c0]https://github.com/joseluisq/static-web-server/commit/65250c0 Minor simplications on server module.
- [b94fe72]https://github.com/joseluisq/static-web-server/commit/b94fe72 Update core modules structure.
- [da5bdc3]https://github.com/joseluisq/static-web-server/commit/da5bdc3 Re-export few core lib modules.
- [57c27f4]https://github.com/joseluisq/static-web-server/commit/57c27f4 Deny(warnings) on lib
- [a3744d4]https://github.com/joseluisq/static-web-server/commit/a3744d4 Simplify conditionals on rejection filter.

__Docs__

- [933a3c4]https://github.com/joseluisq/static-web-server/commit/933a3c4 Feature documentations updates (also [0ef21c4]https://github.com/joseluisq/static-web-server/commit/0ef21c4)
- [78033d0]https://github.com/joseluisq/static-web-server/commit/78033d0 CLI arguments and environment variables descriptions.

## v2.0.0-beta.1 - 2021-01-12

First major beta release `v2.0.0-beta.1` with notable changes.

#### Built-in features

It uses **Tokio** `v0.2` and **Warp** `v0.2` (**Hyper** `v0.13`).
PR [#28]https://github.com/joseluisq/static-web-server/pull/28

- Environment variables and CLI arguments setup
- Lightweight and configurable logging
- Head responses support
- GZip, Deflate and Brotli compression support
- Compression for text-based web file only
- Termination signal handling.
- Default error pages (404, 500x, etc)
- GZip, Deflate or Brotli compression can be optional
- Compression on demand via `Accept-Encoding` header
- Cache control headers for assets
- Docker scratch & Alpine images
- MacOs binary support

#### Bugfixes

- Resolves [#24]https://github.com/joseluisq/static-web-server/issues/24 - Error on 8GB file

#### Additional features

- Resolves [#17]https://github.com/joseluisq/static-web-server/issues/17 - Make assets directory path optional. Since this major release doesn't include an assets dir just a root.
diff --git a/docs/configuration/command-line-arguments.md b/docs/configuration/command-line-arguments.md
new file mode 100644
index 0000000..304bc9f
--- /dev/null
+++ b/docs/configuration/command-line-arguments.md
@@ -0,0 +1,83 @@
# Command-Line Arguments

Server can be configured via the following command-line arguments.

!!! tip "Remember"
    - Command-line arguments are equivalent to their environment variables.
    - Command-line arguments take precedence over their [environment variables](./environment-variables.md).


```
$ static-web-server -h

static-web-server 2.1.0
Jose Quintana <https://git.io/joseluisq>
A blazing fast and asynchronous web server for static files-serving.

USAGE:
    static-web-server [OPTIONS]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
        --basic-auth <basic-auth>
            It provides The "Basic" HTTP Authentication scheme using credentials as "user-id:password" pairs. Password
            must be encoded using the "BCrypt" password-hashing function [env: SERVER_BASIC_AUTH=]  [default: ]
    -e, --cache-control-headers <cache-control-headers>
            Enable cache control headers for incoming requests based on a set of file types. The file type list can be
            found on `src/control_headers.rs` file [env: SERVER_CACHE_CONTROL_HEADERS=]  [default: true]
    -x, --compression <compression>
            Gzip, Deflate or Brotli compression on demand determined by the Accept-Encoding header and applied to text-
            based web file types only [env: SERVER_COMPRESSION=]  [default: true]
    -c, --cors-allow-origins <cors-allow-origins>
            Specify an optional CORS list of allowed origin hosts separated by comas. Host ports or protocols aren't
            being checked. Use an asterisk (*) to allow any host [env: SERVER_CORS_ALLOW_ORIGINS=]  [default: ]
    -z, --directory-listing <directory-listing>
            Enable directory listing for all requests ending with the slash character (‘/’) [env:
            SERVER_DIRECTORY_LISTING=]  [default: false]
    -f, --fd <fd>
            Instead of binding to a TCP port, accept incoming connections to an already-bound TCP socket listener on the
            specified file descriptor number (usually zero). Requires that the parent process (e.g. inetd, launchd, or
            systemd) binds an address and port on behalf of static-web-server, before arranging for the resulting file
            descriptor to be inherited by static-web-server. Cannot be used in conjunction with the port and host
            arguments. The included systemd unit file utilises this feature to increase security by allowing the static-
            web-server to be sandboxed more completely [env: SERVER_LISTEN_FD=]
    -a, --host <host>
            Host address (E.g 127.0.0.1 or ::1) [env: SERVER_HOST=]  [default: ::]

    -t, --http2 <http2>
            Enable HTTP/2 with TLS support [env: SERVER_HTTP2_TLS=]  [default: false]

        --http2-tls-cert <http2-tls-cert>
            Specify the file path to read the certificate [env: SERVER_HTTP2_TLS_CERT=]  [default: ]

        --http2-tls-key <http2-tls-key>
            Specify the file path to read the private key [env: SERVER_HTTP2_TLS_KEY=]  [default: ]

    -g, --log-level <log-level>
            Specify a logging level in lower case. Values: error, warn, info, debug or trace [env: SERVER_LOG_LEVEL=]
            [default: error]
        --page404 <page404>
            HTML file path for 404 errors. If path is not specified or simply don't exists then server will use a
            generic HTML error message [env: SERVER_ERROR_PAGE_404=]  [default: ./public/404.html]
        --page50x <page50x>
            HTML file path for 50x errors. If path is not specified or simply don't exists then server will use a
            generic HTML error message [env: SERVER_ERROR_PAGE_50X=]  [default: ./public/50x.html]
    -p, --port <port>                                      Host port [env: SERVER_PORT=]  [default: 80]
    -d, --root <root>
            Root directory path of static files [env: SERVER_ROOT=]  [default: ./public]

        --security-headers <security-headers>
            Enable security headers by default when HTTP/2 feature is activated. Headers included: "Strict-Transport-
            Security: max-age=63072000; includeSubDomains; preload" (2 years max-age), "X-Frame-
            Options: DENY", "X-XSS-Protection: 1; mode=block" and "Content-Security-Policy: frame-ancestors
            'self'" [env: SERVER_SECURITY_HEADERS=]  [default: false]
    -n, --threads-multiplier <threads-multiplier>
            Number of worker threads multiplier that'll be multiplied by the number of system CPUs using the formula:
            `worker threads = number of CPUs * n` where `n` is the value that changes here. When multiplier value is 0
            or 1 then one thread per core is used. Number of worker threads result should be a number between 1 and
            32,768 though it is advised to keep this value on the smaller side [env: SERVER_THREADS_MULTIPLIER=]
            [default: 1]
```
diff --git a/docs/configuration/environment-variables.md b/docs/configuration/environment-variables.md
new file mode 100644
index 0000000..231bb35
--- /dev/null
+++ b/docs/configuration/environment-variables.md
@@ -0,0 +1,58 @@
# Environment Variables

Server can be configured via the following environment variables arguments.

!!! tip "Remember"
    - Environment variables are equivalent to their command-line arguments.
    - [Command line arguments](./environment-variables.md) take precedence over their environment variables.

### SERVER_HOST
The address of the host (E.g 127.0.0.1). Default `[::]`.

### SERVER_PORT
The port of the host. Default `80`.

### SERVER_LISTEN_FD
Optional file descriptor number (e.g. `0`) to inherit an already-opened TCP listener on (instead of using `SERVER_HOST` and/or `SERVER_PORT`).

### SERVER_ROOT
Relative or absolute root directory path of static files. Default `./public`.

### SERVER_LOG_LEVEL
Specify a logging level in lower case. Possible values are `error`, `warn`, `info`, `debug` or `trace`. Default `error`.

### SERVER_ERROR_PAGE_404
HTML file path for 404 errors. If path is not specified or simply don't exists then server will use a generic HTML error message. Default `./public/404.html`.

### SERVER_ERROR_PAGE_50X
HTML file path for 50x errors. If path is not specified or simply don't exists then server will use a generic HTML error message. Default `./public/50x.html`

### SERVER_THREADS_MULTIPLIER
Number of worker threads multiplier that'll be multiplied by the number of system CPUs using the formula: `worker threads = number of CPUs * n` where `n` is the value that changes here. When multiplier value is 0 or 1 then the `number of CPUs` is used. Number of worker threads result should be a number between 1 and 32,768 though it is advised to keep this value on the smaller side. Default one thread per core.

### SERVER_HTTP2_TLS
Enable HTTP/2 with TLS support. Make sure also to adjust current server port. Default `false` (disabled).

### SERVER_HTTP2_TLS_CERT
Specify the file path to read the certificate. Default empty.

### SERVER_HTTP2_TLS_KEY
Specify the file path to read the private key. Default empty.

### SERVER_CORS_ALLOW_ORIGINS
Specify a optional CORS list of allowed origin hosts separated by comas. Host ports or protocols aren't being checked. Use an asterisk (*) to allow any host. Default empty (disabled).

### SERVER_COMPRESSION
Gzip, Deflate or Brotli compression on demand determined by the *Accept-Encoding* header and applied to text-based web file types only. See [ad-hoc mime-type list]https://github.com/joseluisq/static-web-server/blob/master/src/compression.rs#L20. Default `true` (enabled).

### SERVER_DIRECTORY_LISTING
Enable directory listing for all requests ending with the slash character (‘/’). Default `false` (disabled).

### SERVER_SECURITY_HEADERS
Enable security headers by default when HTTP/2 feature is activated. Headers included: `Strict-Transport-Security: max-age=63072000; includeSubDomains; preload` (2 years max-age), `X-Frame-Options: DENY`, `X-XSS-Protection: 1; mode=block` and `Content-Security-Policy: frame-ancestors 'self'`. Default `false` (disabled).

### SERVER_CACHE_CONTROL_HEADERS
Enable cache control headers for incoming requests based on a set of file types. The file type list can be found on [`src/control_headers.rs`]./src/control_headers.rs file. Default `true` (enabled).

### SERVER_BASIC_AUTH
It provides [The "Basic" HTTP Authentication Scheme]https://datatracker.ietf.org/doc/html/rfc7617 using credentials as `user-id:password` pairs, encoded using `Base64`. Password must be encoded using the [BCrypt]https://en.wikipedia.org/wiki/Bcrypt password-hashing function. Default empty (disabled).
diff --git a/docs/contributions.md b/docs/contributions.md
new file mode 100644
index 0000000..2fd3681
--- /dev/null
+++ b/docs/contributions.md
@@ -0,0 +1,5 @@
# Contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in current work by you, as defined in the Apache-2.0 license, shall be dual licensed as described below, without any additional terms or conditions.

Feel free to send some [Pull request]https://github.com/joseluisq/static-web-server/pulls or file an [issue]https://github.com/joseluisq/static-web-server/issues.
diff --git a/docs/download-and-install.md b/docs/download-and-install.md
new file mode 100644
index 0000000..959a8de
--- /dev/null
+++ b/docs/download-and-install.md
@@ -0,0 +1,26 @@
# Download and Install

Latest featured downloads

[Linux x86_64]https://github.com/joseluisq/static-web-server/releases/download/v2.1.0/static-web-server-v2.1.0-x86_64-unknown-linux-gnu.tar.gz{ .md-button } [macOS x86_64]https://github.com/joseluisq/static-web-server/releases/download/v2.1.0/static-web-server-v2.1.0-x86_64-apple-darwin.tar.gz{ .md-button } [Windows x86_64]https://github.com/joseluisq/static-web-server/releases/download/v2.1.0/static-web-server-v2.1.0-x86_64-pc-windows-msvc.zip{ .md-button }

See all [available releases]https://github.com/joseluisq/static-web-server/releases.

### v2.1.0 - 2021-10-23

See [v2.1.0 release history]https://github.com/joseluisq/static-web-server/releases/tag/v2.1.0.

- [static-web-server-v2.1.0-aarch64-apple-darwin.tar.gz]https://github.com/joseluisq/static-web-server/releases/download/v2.1.0/static-web-server-v2.1.0-aarch64-apple-darwin.tar.gz <br>`076b7e801a3252ccee9391d94a517bf9d70e29d1b93c744c9ea7d9fa3ffc63fb`
- [static-web-server-v2.1.0-aarch64-unknown-linux-gnu.tar.gz]https://github.com/joseluisq/static-web-server/releases/download/v2.1.0/static-web-server-v2.1.0-aarch64-unknown-linux-gnu.tar.gz <br>`7efd6f5b4db3cd7fc423d3d3a7c68f1b86411449f2a2030aeb19aea857db9f5e`
- [static-web-server-v2.1.0-aarch64-unknown-linux-musl.tar.gz]https://github.com/joseluisq/static-web-server/releases/download/v2.1.0/static-web-server-v2.1.0-aarch64-unknown-linux-musl.tar.gz <br>`5888d772b0ecf93d87eb39def45c5b09d7ac2fc8a236d6e65fd46035b5ed4afb`
- [static-web-server-v2.1.0-arm-unknown-linux-gnueabihf.tar.gz]https://github.com/joseluisq/static-web-server/releases/download/v2.1.0/static-web-server-v2.1.0-arm-unknown-linux-gnueabihf.tar.gz <br>`cde040c48d7032c1a6d9f7990322112c3f423ed4b527c77d10b9d71a32246351`
- [static-web-server-v2.1.0-i686-pc-windows-msvc.zip]https://github.com/joseluisq/static-web-server/releases/download/v2.1.0/static-web-server-v2.1.0-i686-pc-windows-msvc.zip <br>`4b85b8615627087720bc719e37d8b5efb7d5260caeb30b38598064675fba0227`
- [static-web-server-v2.1.0-i686-unknown-freebsd.tar.gz]https://github.com/joseluisq/static-web-server/releases/download/v2.1.0/static-web-server-v2.1.0-i686-unknown-freebsd.tar.gz <br>`1e147aa1dd7a22ba7b9b829f60d6dc4bec20c4ff42e3ec147898d01774c88fd3`
- [static-web-server-v2.1.0-i686-unknown-linux-gnu.tar.gz]https://github.com/joseluisq/static-web-server/releases/download/v2.1.0/static-web-server-v2.1.0-i686-unknown-linux-gnu.tar.gz <br>`c113dfa00f04c2b6f2a1e8f1700c0710dc0a6a430d7e2a7e5f10bd1d29af5a84`
- [static-web-server-v2.1.0-i686-unknown-linux-musl.tar.gz]https://github.com/joseluisq/static-web-server/releases/download/v2.1.0/static-web-server-v2.1.0-i686-unknown-linux-musl.tar.gz <br>`d6070951586785a87cc340aca64cb2df13f41f94ab3d0f7bacfbfdc7efbb8d53`
- [static-web-server-v2.1.0-x86_64-apple-darwin.tar.gz]https://github.com/joseluisq/static-web-server/releases/download/v2.1.0/static-web-server-v2.1.0-x86_64-apple-darwin.tar.gz <br>`55ded256c9a1698ab2532d30af29b7329dd2d3c5fb073a268e4cc75dff415b74`
- [static-web-server-v2.1.0-x86_64-pc-windows-gnu.zip]https://github.com/joseluisq/static-web-server/releases/download/v2.1.0/static-web-server-v2.1.0-x86_64-pc-windows-gnu.zip <br>`51a3dc66a346e60825636e9f29941ebd6bed1b57111b05704f3fffd9340e7a98`
- [static-web-server-v2.1.0-x86_64-pc-windows-msvc.zip]https://github.com/joseluisq/static-web-server/releases/download/v2.1.0/static-web-server-v2.1.0-x86_64-pc-windows-msvc.zip <br>`d34ac9f47e5a3f3f48c79500dcb1c80993871ab3f8e4a328ebd7ee6929ae7679`
- [static-web-server-v2.1.0-x86_64-unknown-freebsd.tar.gz]https://github.com/joseluisq/static-web-server/releases/download/v2.1.0/static-web-server-v2.1.0-x86_64-unknown-freebsd.tar.gz <br>`4e7a444d314c7ea807a3731485db17e6f130285f39633f566349b51b78d3ede5`
- [static-web-server-v2.1.0-x86_64-unknown-linux-gnu.tar.gz]https://github.com/joseluisq/static-web-server/releases/download/v2.1.0/static-web-server-v2.1.0-x86_64-unknown-linux-gnu.tar.gz <br>`c39445deacef14e9e39df24235d22d9936c62cf1e1490e9c4f352b0563db9db7`
- [static-web-server-v2.1.0-x86_64-unknown-linux-musl.tar.gz]https://github.com/joseluisq/static-web-server/releases/download/v2.1.0/static-web-server-v2.1.0-x86_64-unknown-linux-musl.tar.gz <br>`de3b0b438ed348d422e3d118863da8d20a8b395fb4af59721f50057cc82cd126`
diff --git a/docs/examples/basic-authentication.md b/docs/examples/basic-authentication.md
new file mode 100644
index 0000000..77e9d63
--- /dev/null
+++ b/docs/examples/basic-authentication.md
@@ -0,0 +1,23 @@
# Basic HTTP Authentication

Create "user-id:password" pairs using your favourite tool.

```sh
htpasswd -nbBC5 "username" "password"
# username:$2y$05$KYOM0uaMQnEknnu/ckcCuuFyNQbc8BJEUk5X.ixtoCQpjXsc4geHK
```

!!! tip "Tip"
    Speed of the password verification depends on the computing time cost of `bcrypt` algorithm used.
    For example the `htpasswd` tool supports a `-C` argument in order to set the `bcrypt`'s computing time (higher is more secure but slower, default: 5, valid: 4 to 17).



Finally assign the credentails and run the server.

```sh
static-web-server 
    --port 8787
    --root ./my-public-dir
    --basic-auth='username:$2y$05$KYOM0uaMQnEknnu/ckcCuuFyNQbc8BJEUk5X.ixtoCQpjXsc4geHK'
```
diff --git a/docs/examples/compression.md b/docs/examples/compression.md
new file mode 100644
index 0000000..5c4a92a
--- /dev/null
+++ b/docs/examples/compression.md
@@ -0,0 +1 @@
# Compression
diff --git a/docs/examples/directory-listing.md b/docs/examples/directory-listing.md
new file mode 100644
index 0000000..40bec1d
--- /dev/null
+++ b/docs/examples/directory-listing.md
@@ -0,0 +1 @@
# Directory Listing
diff --git a/docs/examples/docker.md b/docs/examples/docker.md
new file mode 100644
index 0000000..54a77ec
--- /dev/null
+++ b/docs/examples/docker.md
@@ -0,0 +1,54 @@
# Docker

`SWS` has first-class [Docker]https://docs.docker.com/get-started/overview/ support. It provides a [Scratch]https://hub.docker.com/_/scratch as well as the latest [Alpine Linux]https://hub.docker.com/_/alpine Docker images.

## Run a container

```sh
# Scratch image (just the binary)
docker run --rm -it -p 8787:80 joseluisq/static-web-server:2

# Or Alpine image
docker run --rm -it -p 8787:80 joseluisq/static-web-server:2-alpine
```

## Dockerfile

```Dockerfile
# Scratch image (just the binary)
FROM joseluisq/static-web-server:2

# Or Alpine image
FROM joseluisq/static-web-server:2-alpine
```

## Docker Compose

Below a [Docker Compose]https://docs.docker.com/compose/ example using the [Traefik Proxy]https://traefik.io/.

```yaml
version: "3.3"

services:
  web:
    image: joseluisq/static-web-server:2
    environment:
      # Note: those envs are customizable but also optional
      - SERVER_HOST=127.0.0.1
      - SERVER_PORT=80
      - SERVER_ROOT=/public
    volumes:
      - ./some-dir-path:/public
    labels:
      - "traefik.enable=true"
      - "traefik.frontend.entryPoints=https"
      - "traefik.backend=localhost_dev"
      - "traefik.frontend.rule=Host:localhost.dev"
      - "traefik.port=80"
    networks:
      - traefik_net

networks:
  traefik_net:
    external: true
```
diff --git a/docs/examples/file-descriptor-socket-passing.md b/docs/examples/file-descriptor-socket-passing.md
new file mode 100644
index 0000000..0deb191
--- /dev/null
+++ b/docs/examples/file-descriptor-socket-passing.md
@@ -0,0 +1,14 @@
# File Descriptor Socket Passing

A **systemd** unit files example for [socket activation]http://0pointer.de/blog/projects/socket-activation.html can be found under the [`systemd/`]https://github.com/joseluisq/static-web-server/tree/master/systemd directory of the Git repository.
If you are using `inetd`, its "`wait`" option should be used in conjunction with static-web-server's `--fd 0`
option.

Alternatively, the light-weight [`systemfd`]https://github.com/mitsuhiko/systemfd utility may be
useful. Especially for testing.

For example using `systemfd` utility as follow:

```sh
systemfd --no-pid -s http::8091 -- path/to/static-web-server --fd 0
```
diff --git a/docs/examples/http1.md b/docs/examples/http1.md
new file mode 100644
index 0000000..a805584
--- /dev/null
+++ b/docs/examples/http1.md
@@ -0,0 +1,2 @@
# HTTP/1

diff --git a/docs/examples/http2-tls.md b/docs/examples/http2-tls.md
new file mode 100644
index 0000000..326b79c
--- /dev/null
+++ b/docs/examples/http2-tls.md
@@ -0,0 +1 @@
# HTTP/2 TLS
diff --git a/docs/examples/logging.md b/docs/examples/logging.md
new file mode 100644
index 0000000..b921bbe
--- /dev/null
+++ b/docs/examples/logging.md
@@ -0,0 +1 @@
# Logging
diff --git a/docs/getting-started.md b/docs/getting-started.md
new file mode 100644
index 0000000..ad49d95
--- /dev/null
+++ b/docs/getting-started.md
@@ -0,0 +1,13 @@
# Getting Started

First [download]./download-and-install.md the binary for your platform.

Then just type the following command.

```sh
static-web-server --port 8787 --root ./my-public-dir
```

For details about the avilable options type `static-web-server -h` or go [Command-line arguments]./configuration/command-line-arguments.md section.

If you want more advanced examples, take a look at [the examples]./examples/http1.md section.
diff --git a/docs/index.md b/docs/index.md
index 5615259..06668da 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -1,30 +1,61 @@
# Welcome to MkDocs

For full documentation visit [mkdocs.org]https://www.mkdocs.org.

## Commands

* `mkdocs new [dir-name]` - Create a new project.
* `mkdocs serve` - Start the live-reloading docs server.
* `mkdocs build` - Build the documentation site.
* `mkdocs -h` - Print help message and exit.

## Project layout

```rust
#![deny(warnings)]
#![deny(rust_2018_idioms)]

#[cfg(all(target_env = "musl", target_pointer_width = "64"))]
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

use static_web_server::{Result, Server};

fn main() -> Result {
    Server::new().run()?;

    Ok(())
}

```
<div>
  <div align="center">
    <img
      src="https://camo.githubusercontent.com/a08032a2db94aea229991af8f73c45cc95174c8066dc7a6b1f88a79c94cf1093/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f642f64352f527573745f70726f6772616d6d696e675f6c616e67756167655f626c61636b5f6c6f676f2e7376672f3130323470782d527573745f70726f6772616d6d696e675f6c616e67756167655f626c61636b5f6c6f676f2e7376672e706e67"
      height="100" width="100"
    />
  </div>

  <h1 align="center">Static Web Server</h1>

  <h4 align="center">
    A blazing fast and asynchronous web server for static files-serving ⚡
  </h4>

<div align="center">
<a href="https://github.com/joseluisq/static-web-server/actions?query=workflow%3ACI" title="CI"><img src="https://github.com/joseluisq/static-web-server/workflows/CI/badge.svg"></a> 
<a href="https://hub.docker.com/r/joseluisq/static-web-server/" title="Docker Image Version (tag latest semver)"><img src="https://img.shields.io/docker/v/joseluisq/static-web-server/2"></a> 
<a href="https://hub.docker.com/r/joseluisq/static-web-server/tags" title="Docker Image Size (tag)"><img src="https://img.shields.io/docker/image-size/joseluisq/static-web-server/2"></a> 
<a href="https://hub.docker.com/r/joseluisq/static-web-server/" title="Docker Image"><img src="https://img.shields.io/docker/pulls/joseluisq/static-web-server.svg"></a> 
</div>

</div>

## Overview

**Static Web Server** (or `SWS` abbreviated) is a very small and fast production-ready web server suitable to serve static web files or assets.

It is focused on **lightness and easy to use** principles but keeping [high performance and safety]https://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.html powered by [The Rust Programming Language]https://rust-lang.org.

Written on top of [Hyper]https://github.com/hyperium/hyper and [Tokio]https://github.com/tokio-rs/tokio runtime. It provides [concurrent and asynchronous networking abilities]https://rust-lang.github.io/async-book/01_getting_started/02_why_async.html as well as the latest HTTP/1 - HTTP/2 implementations.

It's cross-platform and available for `Linux`, `macOS`, `Windows` and `FreeBSD` (`x86`/`x86_64` and `ARM`/`ARM64`) as well as `Docker`.

!!! tip "Tip"
    - If you're looking for `v1` please go to [1.x](https://github.com/joseluisq/static-web-server/tree/1.x) branch.
    - If you want to migrate from `v1` to `v2` please take a look at [v2.0.0](https://github.com/joseluisq/static-web-server/releases/tag/v2.0.0) release.

## Features

- Built with [Rust]https://rust-lang.org which is focused on [safety, speed and concurrency]https://kornel.ski/rust-c-speed.
- Memory safe and very reduced CPU and RAM overhead.
- Blazing fast static files-serving and asynchronous powered by latest [Hyper]https://github.com/hyperium/hyper/, [Tokio]https://github.com/tokio-rs/tokio and a set of [awesome crates]./Cargo.toml.
- Single __4MB__ (uncompressed) and fully static binary with no dependencies ([Musl libc]https://doc.rust-lang.org/edition-guide/rust-2018/platform-and-target-support/musl-support-for-fully-static-binaries.html). Suitable for running on [any Linux distro]https://en.wikipedia.org/wiki/Linux_distribution or [Docker container]https://hub.docker.com/r/joseluisq/static-web-server/tags.
- Optional GZip, Deflate or Brotli compression for text-based web files only.
- Compression on demand via [Accept-Encoding]https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding header.
- [Partial Content Delivery]https://en.wikipedia.org/wiki/Byte_serving support for byte-serving of large files.
- Optional [Cache Control]https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control headers for assets.
- [HEAD]https://tools.ietf.org/html/rfc7231#section-4.3.2 responses.
- Lightweight and configurable logging via [tracing]https://github.com/tokio-rs/tracing crate.
- [Termination signal]https://www.gnu.org/software/libc/manual/html_node/Termination-Signals.html handling.
- [HTTP/2]https://tools.ietf.org/html/rfc7540 + TLS support.
- [Security headers]https://web.dev/security-headers/ for HTTP/2 by default.
- Customizable number of worker threads.
- Optional directory listing.
- [CORS]https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS support.
- Basic HTTP Authentication.
- Default and custom error pages.
- Configurable using CLI arguments or environment variables.
- First-class [Docker]https://docs.docker.com/get-started/overview/ support. [Scratch]https://hub.docker.com/_/scratch and latest [Alpine Linux]https://hub.docker.com/_/alpine Docker images available.
- Ability to accept a socket listener as a file descriptor for use in sandboxing and on-demand applications (E.g [systemd]http://0pointer.de/blog/projects/socket-activation.html).
- Cross-platform. Binaries available for Linux, macOS, Windows & FreeBSD x86_64 / ARM.
diff --git a/docs/license.md b/docs/license.md
new file mode 100644
index 0000000..cb90e83
--- /dev/null
+++ b/docs/license.md
@@ -0,0 +1,5 @@
# License

This work is primarily distributed under the terms of both the [MIT license]https://github.com/joseluisq/static-web-server/blob/master/LICENSE-MIT and the [Apache License (Version 2.0)]https://github.com/joseluisq/static-web-server/blob/master/LICENSE-APACHE.

© 2019-present [Jose Quintana]https://git.io/joseluisq
diff --git a/docs/platforms-architectures.md b/docs/platforms-architectures.md
new file mode 100644
index 0000000..78fe858
--- /dev/null
+++ b/docs/platforms-architectures.md
@@ -0,0 +1,48 @@
# Platforms & Architectures

Currently only the following platforms and architectures are supported.

## Linux

#### x86
  - `i686-unknown-linux-gnu` 
  - `i686-unknown-linux-musl`

#### x86_64
  - `x86_64-unknown-linux-gnu`
  - `x86_64-unknown-linux-musl`

#### ARM
  - `arm-unknown-linux-gnueabihf`

#### ARM64
  - `aarch64-unknown-linux-musl`
  - `aarch64-unknown-linux-gnu`

## macOS

#### x86_64
  - `x86_64-apple-darwin`

#### ARM64
  - `aarch64-apple-darwin`

## Windows

#### x86
  - `i686-pc-windows-msvc`

#### x86_64
  - `x86_64-pc-windows-msvc`
  - `x86_64-pc-windows-gnu`

#### ARM64
  - ~~`aarch64-pc-windows-msvc`~~ (temporarily disabled until [briansmith/ring#1167]https://github.com/briansmith/ring/issues/1167)

## FreeBSD

#### x86
  - `i686-unknown-freebsd`

#### x86_64
  - `x86_64-unknown-freebsd`
diff --git a/mkdocs.yml b/mkdocs.yml
index 6a61f5f..3d02f65 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -19,18 +19,18 @@ theme:
  palette:
    - scheme: default
      primary: black
      accent: indigo
      accent: blue
      toggle:
        icon: material/toggle-switch-off-outline
        name: Switch to dark mode
    - scheme: slate
      primary: black
      accent: grey
      accent: blue
      toggle:
        icon: material/toggle-switch
        name: Switch to light mode
  font:
    text: 'Fira Sans'
    text: 'Open Sans'
    code: 'Droid Sans Mono'
  favicon: https://camo.githubusercontent.com/a08032a2db94aea229991af8f73c45cc95174c8066dc7a6b1f88a79c94cf1093/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f642f64352f527573745f70726f6772616d6d696e675f6c616e67756167655f626c61636b5f6c6f676f2e7376672f3130323470782d527573745f70726f6772616d6d696e675f6c616e67756167655f626c61636b5f6c6f676f2e7376672e706e67

@@ -42,29 +42,55 @@ extra:
      link: 'https://twitter.com/joseluis_q'

markdown_extensions:
    - codehilite
    - admonition
    - meta
    - toc:
        permalink: true
    - markdown.extensions.tables
    - pymdownx.arithmatex
    - pymdownx.betterem
    - pymdownx.caret
    - pymdownx.critic
    - pymdownx.details
    - pymdownx.emoji:
        emoji_generator: !!python/name:pymdownx.emoji.to_svg
    - pymdownx.magiclink:
        repo_url_shortener: true
        repo_url_shorthand: true
        provider: "github"
        user: "facelessuser"
        repo: "pymdown-extensions"
    - pymdownx.tilde
    - pymdownx.emoji
    - pymdownx.superfences
    - pymdownx.inlinehilite
    - pymdownx.mark
    - pymdownx.smartsymbols
    - pymdownx.tasklist
  - codehilite
  - admonition
  - meta
  - attr_list
  - footnotes
  - tables
  - toc:
      permalink: true
  - markdown.extensions.tables
  - pymdownx.arithmatex
  - pymdownx.betterem
  - pymdownx.critic
  - pymdownx.caret
  - pymdownx.keys
  - pymdownx.mark
  - pymdownx.tilde
  - pymdownx.details
  - pymdownx.emoji:
      emoji_generator: !!python/name:pymdownx.emoji.to_svg
  - pymdownx.magiclink:
      repo_url_shortener: true
      repo_url_shorthand: true
      provider: "github"
      user: "facelessuser"
      repo: "pymdown-extensions"
  - pymdownx.emoji
  - pymdownx.superfences
  - pymdownx.inlinehilite
  - pymdownx.smartsymbols
  - pymdownx.tasklist

nav:
  - 'Overview': 'index.md'
  - 'Download and Install': 'download-and-install.md'
  - 'Getting Started': 'getting-started.md'
  - 'Configuration':
    - 'Command Line Arguments': 'configuration/command-line-arguments.md'
    - 'Environment Variables': 'configuration/environment-variables.md'
  - 'Examples':
    - 'HTTP/1': 'examples/http1.md'
    - 'HTTP/2 and TLS': 'examples/http2-tls.md'
    - 'Logging': 'examples/logging.md'
    - 'Compression': 'examples/compression.md'
    - 'Basic Authentication': 'examples/basic-authentication.md'
    - 'Directory Listing': 'examples/directory-listing.md'
    - 'Docker': 'examples/docker.md'
    - 'File Descriptor Socket Passing': './examples/file-descriptor-socket-passing.md'
  - 'Platforms & Architectures': 'platforms-architectures.md'
  - 'Changelog v2': 'changelog-v2.md'
  - 'Changelog v1': 'changelog-v1.md'
  - 'Contributions': 'contributions.md'
  - 'License': 'license.md'