Giter Site home page Giter Site logo

denisidoro / static-web-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from static-web-server/static-web-server

0.0 1.0 0.0 1.26 MB

A cross-platform, blazing fast and asynchronous web server for static files-serving. ⚡

Home Page: https://sws.joseluisq.net

License: Apache License 2.0

Shell 1.11% JavaScript 0.02% Lua 1.57% Rust 92.12% CSS 0.07% Makefile 3.23% HTML 0.56% Dockerfile 1.31%

static-web-server's Introduction

Static Web Server

A blazing fast and asynchronous web server for static files-serving ⚡

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 while keeping high performance and safety powered by The Rust Programming Language.

Written on top of Hyper and Tokio runtime. It provides concurrent and asynchronous networking abilities 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, ARM/ARM64) as well as Docker.

static-web-server

Features

  • Built with Rust which is focused on safety, speed and concurrency.
  • Memory safe and very reduced CPU and RAM overhead.
  • Blazing fast static files-serving and asynchronous powered by latest Hyper, Tokio and a set of awesome crates.
  • Single 4MB (uncompressed) and fully static binary with no dependencies (Musl libc). Suitable for running on any Linux distro or Docker container.
  • Optional GZip, Deflate or Brotli compression for text-based web files only.
  • Compression on-demand via Accept-Encoding header.
  • Partial Content Delivery support for byte-serving of large files.
  • Optional Cache-Control headers for assets.
  • Termination signal handling with graceful shutdown ability and grace period.
  • HTTP/2 and TLS support.
  • Security headers for HTTP/2 by default.
  • HEAD responses.
  • Lightweight and configurable logging via tracing crate.
  • Customizable number of worker threads.
  • Optional directory listing.
  • CORS support.
  • Basic HTTP Authentication.
  • Customizable HTTP response headers for specific file requests via glob patterns.
  • Fallback pages for 404 errors, useful for Single-page applications.
  • Run the server as a Windows Service.
  • Configurable using CLI arguments, environment variables or a TOML file.
  • Default and custom error pages.
  • Custom URL rewrites via glob patterns.
  • Custom URL redirects via glob patterns.
  • Support for serving pre-compressed (Gzip/Brotli) files.
  • First-class Docker support. Scratch and latest Alpine Linux Docker images.
  • Ability to accept a socket listener as a file descriptor for use in sandboxing and on-demand applications (E.g systemd).
  • Cross-platform. Pre-compiled binaries for Linux, macOS, Windows and FreeBSD (x86,x86_64,ARM,ARM64).

Documentation

For more details about the API, usage and examples please have a look at The Documentation Website.

Releases

Benchmarks

See more details on benchmark/BENCHMARKS.md

Notes

  • If you're looking for v1 please go to 1.x branch.
  • If you want to migrate from v1 to v2 please take a look at Migrating from v1 to v2 release.

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 or file an issue.

License

This work is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

© 2019-present Jose Quintana

static-web-server's People

Contributors

joseluisq avatar tim-seoss avatar denisidoro avatar dlalic avatar henningholmde avatar snyk-bot avatar kianmeng avatar renbaoshuo avatar csmith avatar dlvoy avatar funkyfuture avatar nelsonjchen avatar phartenfeller avatar acelot avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.