Simple and fast web server

Overview

see

GitHub Workflow Status Crates.io LICENSE Document

Overview

Simple and fast web server as a single executable with no extra dependencies required.

Features

  • Built with Tokio and Hyper
  • TLS encryption through Rustls
  • HTTP/1 and HTTP/2 support
  • Content compression auto, gzip, deflate or br
  • Rewrite rules for redirection
  • Allow/deny addresses allowing wildcards
  • Location with regex matching
  • Reverse proxy
  • Basic authentication
  • Error handling
  • Customized logs
  • And more

Usage

Quick start in current directory:

see start

or specify the port and directory via parameters:

see start -b 80 -p /root/www

Also, you can use see -c [FILE] to specify a configuration file or just use the default one in ~/.see.conf. Below, a simple configuration example to start the HTTPS server:

server {
    listen 80
    root /root/www
}

server {
    listen 443
    root /root/www
    host example.com
    https {
        key ./ssl.key
        cert ./ssl.pem
    }
}

Documentation

The documentation is available at docs/. Take a look at it to get more information about more configuration options.

Installation

Download the compiled executable corresponding to your system from the release page.

Cargo

cargo install see
# or
cargo install --git https://github.com/wyhaya/see

Docker

docker pull wyhaya/see

Container

Add the following to see.conf:

server {
    listen 80
    echo Hello, world!
}

and run the container:

docker run -idt --name see -p 80:80 -p 443:443 -v '$PWD'/see:/ wyhaya/see

lastly, open the link http://localhost and you should see Hello, world!.

Licensing

see is released under MIT license. Check the LICENSE file for more details.


ToDo

  • Fix docker container (ubuntu, ca-certificates)
  • Fix the bug of matching https and http on the same port
  • Support global configuration
  • Support certificate with password
  • Daemon for Unix systems and service for Windows
Comments
  • Config file not read

    Config file not read

    When I run this command: see start -t -c see.yml

    I get the error: Serving path : /home/TestUser Serving address: http://0.0.0.0 error: Cannot bind to address: 0.0.0.0:80 Os { code: 13, kind: PermissionDenied, message: "Permission denied" }

    see.yml contains:

    • server: listen: 8080 root: /home/TestUser/www
    opened by ZikZakFR 7
  • Log options

    Log options

    I believe that the example is wrong when we want to use more than the mode.

    If I follow the example then:

    log: file: /var/log/www.log format: ${request_path} ${header_host}

    Will return:

    error: Cannot parse mode, It should be 'string', but found: BadValue

    If I use:

    log: mode: file file: /var/log/www.log format: ${request_path} ${header_host}

    Then there is no error but the log doesn't change whatever I use in format.

    opened by ZikZakFR 6
  • error: reached the type-length limit while instantiating

    error: reached the type-length limit while instantiating

    Hello,

    "cargo b --release" ends with the error:

    Compiling hyper v0.13.5 Compiling see v0.0.1 (/home/user/see) error: reached the type-length limit while instantiating <std::slice::IterMut<futures_uti...]]], std::result::Result<(), !>> | = note: consider adding a #![type_length_limit="1205205"] attribute to your crate

    error: aborting due to previous error

    error: could not compile see.

    To learn more, run the command again with --verbose.

    Then "cargo b --verbose --release":

    error: could not compile see.

    Caused by: process didn't exit successfully: rustc --edition=2018 --crate-name see src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C metadata=0b89b58ff303fdbc -C extra-filename=-0b89b58ff303fdbc --out-dir /home/user/see/target/release/deps -L dependency=/home/user/see/target/release/deps --extern ace=/home/user/see/target/release/deps/libace-f3edcb8d40f0e2e0.rlib --extern async_compression=/home/user/see/target/release/deps/libasync_compression-8c62e395b3313650.rlib --extern bright=/home/user/see/target/release/deps/libbright-c6253d40f58194b1.rlib --extern dirs=/home/user/see/target/release/deps/libdirs-694d139253cf792f.rlib --extern futures=/home/user/see/target/release/deps/libfutures-d73fe93c74feb37f.rlib --extern globset=/home/user/see/target/release/deps/libglobset-5f28f28735039fd8.rlib --extern hyper=/home/user/see/target/release/deps/libhyper-047609707ce0b198.rlib --extern lazy_static=/home/user/see/target/release/deps/liblazy_static-7a6a5d78b39cb3bd.rlib --extern libc=/home/user/see/target/release/deps/liblibc-d69bc1d16c59227e.rlib --extern num_cpus=/home/user/see/target/release/deps/libnum_cpus-685e32fbb90c3521.rlib --extern percent_encoding=/home/user/see/target/release/deps/libpercent_encoding-f93b4f00b32f28df.rlib --extern rand=/home/user/see/target/release/deps/librand-fb6c06ae6d7a3ef4.rlib --extern regex=/home/user/see/target/release/deps/libregex-517550e37cf62635.rlib --extern time=/home/user/see/target/release/deps/libtime-0f6dec442bc2198e.rlib --extern tokio=/home/user/see/target/release/deps/libtokio-909a21f0c0ec7910.rlib --extern tokio_rustls=/home/user/see/target/release/deps/libtokio_rustls-205535c160e25f57.rlib --extern webpki_roots=/home/user/see/target/release/deps/libwebpki_roots-730e62b779d4fb33.rlib --extern yaml_rust=/home/user/see/target/release/deps/libyaml_rust-845f3ecf8d13e17f.rlib -L native=/home/user/see/target/release/build/miniz-sys-7294c154801d7ce2/out -L native=/home/user/see/target/release/build/ring-008c1b45642b9eb4/out (exit code: 1)

    opened by ZikZakFR 5
  • Proxy reverse to Google returns

    Proxy reverse to Google returns "404. That's an error."

    Hi.

    Consider the following configuration:

    server {
      listen 8080
      proxy {
        url http://www.google.com$`path`$`query`
      }
    }
    

    If you try to access the URL http://localhost:8080/?q=Rust from your browser, it will show the following error:


    image


    but it should show the correct Google page, like using reverse proxy in Nginx.

    cheers

    opened by silvioprog 4
  • About update

    About update

    It would be nice to update the about area (text and topics) as following:

    image

    This update helps to make it easy to filter and find see in search tools like Google, Bind, GitHub etc.

    opened by silvioprog 3
  • Bump prismjs from 1.20.0 to 1.21.0 in /docs

    Bump prismjs from 1.20.0 to 1.21.0 in /docs

    Bumps prismjs from 1.20.0 to 1.21.0.

    Release notes

    Sourced from prismjs's releases.

    v1.21.0

    Release 1.21.0

    Changelog

    Sourced from prismjs's changelog.

    1.21.0 (2020-08-06)

    New components

    Updated components

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 2
  • Bump time from 0.2.22 to 0.2.23

    Bump time from 0.2.22 to 0.2.23

    Bumps time from 0.2.22 to 0.2.23.

    Changelog

    Sourced from time's changelog.

    0.2.23 [2020-11-17]

    Compatibility notes

    Due to #293, any method that requires knowledge of the local offset will now fail on Linux. For try_ methods, this means returning an error. For others, it means assuming UTC.

    Deprecated

    • UtcOffset::timestamp (moved to UtcOffset::unix_timestamp)
    • UtcOffset::timestamp_nanos (moved to UtcOffset::unix_timestamp_nanos)
    • date (moved to macros::date)
    • time (moved to macros::time)
    • offset (moved to macros::offset)
    • OffsetDateTime::now_local (assumes UTC if unable to be determined)
    • UtcOffset::local_offset_at (assumes UTC if unable to be determined)
    • UtcOffset::current_local_offset (assumes UTC if unable to be determined)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies rust 
    opened by dependabot[bot] 1
  • BUG with try_current_local_offset

    BUG with try_current_local_offset

    ▶ see start -b 8080
    Serving path   : /home/.....
    Serving address: http://0.0.0.0:8080
    thread 'see' panicked at 'called `Result::unwrap()` on an `Err` value: IndeterminateOffset', src/option/directory.rs:155:82
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    thread 'see' panicked at 'Once instance has previously been poisoned', library/std/src/sync/once.rs:394:21
    thread 'see' panicked at 'Once instance has previously been poisoned', library/std/src/sync/once.rs:394:21
    
    opened by lengyijun 1
  • [ERROR]: [line:3] Directive `time` does not allow multiple values

    [ERROR]: [line:3] Directive `time` does not allow multiple values

    Consider the following configuration:

    server {
      directory {
        time "%Y-%m-%d %H:%M"
      }
      listen 8080
      root C:\dev\git\see
    }
    

    If you try to start the server, it raise the following error:

    [ERROR]: [line:3] Directive `time` does not allow multiple values
    

    Note: tried time %Y-%m-%d %H:%M too, but same problem.

    opened by silvioprog 1
  • [ERROR]: [line:5] Directive `Access-Control-Allow-Headers` does not allow multiple values

    [ERROR]: [line:5] Directive `Access-Control-Allow-Headers` does not allow multiple values

    Consider the following configuration:

    server {
      listen 8080
      header {
        Access-Control-Allow-Origin *
        Access-Control-Allow-Headers Authorization, Content-Type, Cache-Control, X-Requested-With
        Access-Control-Allow-Methods GET, POST, PATCH, PUT, DELETE, OPTIONS
      }
    }
    

    When we try to use it, the application raises the following error:

    [ERROR]: [line:5] Directive `Access-Control-Allow-Headers` does not allow multiple values
    

    but it should allow multiple values separated by comma, since according to Mozilla, it is a valid syntax.

    opened by silvioprog 1
  • Bump tokio from 1.18.2 to 1.18.4

    Bump tokio from 1.18.2 to 1.18.4

    Bumps tokio from 1.18.2 to 1.18.4.

    Release notes

    Sourced from tokio's releases.

    Tokio v1.18.3

    1.18.3 (September 27, 2022)

    This release removes the dependency on the once_cell crate to restore the MSRV of the 1.18.x LTS release. (#5048)

    #5048: tokio-rs/tokio#5048

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies rust 
    opened by dependabot[bot] 0
  • Program doesn't exit on SIGINT or SIGTERM

    Program doesn't exit on SIGINT or SIGTERM

    When I run see and press CTRL+C (SIGINT) to stop it, it doesn't exit. Even a SIGTERM signal doesn't stop the process. The only way to stop see is to kill it.

    It would be nice if see could handle this signals and exit gracefully.

    opened by hardcore-sushi 2
  • [BINARY REQUEST] arm, armv7 and aarch64

    [BINARY REQUEST] arm, armv7 and aarch64

    If would be nice to provide binaries for linux-arm, linux-armv7 and linux-aarch64, allowing the users to run see on embedded systems like Android, Raspbian and so on (e.g. miniserve/releases).

    opened by silvioprog 0
  • [FEATURE REQUEST] Extensions support

    [FEATURE REQUEST] Extensions support

    One of the most important features in the popular servers like Nginx and Apache is the ability to extend them. For example:

    • List of Nginx extensions: https://www.nginx.com/resources/wiki/modules
    • List of Apache modules: https://en.wikipedia.org/wiki/List_of_Apache_modules

    It is known that, due to the complexity, it isn't so easy to implement it in see, however, such feature would allow the see tool to get a larger community, since any users would be able to develop their own extensions.

    opened by silvioprog 0
  • [FEATURE REQUEST] Allow to specify

    [FEATURE REQUEST] Allow to specify "worker_threads" and "max_blocking_threads"

    It would be nice to allow the user to configure the "worker_threads" and "max_blocking_threads".

    It can be useful for those who run see on hosted systems (AWS, Azure) and/or on embedded systems (Raspberry).

    Edt:

    Suggestion for configuration:

    worker_threads usize value | auto
    max_blocking_threads value | auto
    
    opened by silvioprog 1
  • feature request: 304 not modified

    feature request: 304 not modified

    Compare to python3.7 -m http.server, see only use half of the memory (awesome)。

    If see has 304 not modified feature like http.server, it would be much better.

    enhancement 
    opened by TerminusBot 2
Owner
null
Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.

Actix Web Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust Features Supports HTTP/1.x and HTTP/2 Streaming and pipelining

Actix 16.3k Jan 8, 2023
A blazingly fast static web server with routing, templating, and security in a single binary you can set up with zero code. :zap::crab:

binserve ⚡ ?? A blazingly fast static web server with routing, templating, and security in a single binary you can set up with zero code. ?? UPDATE: N

Mufeed VH 722 Dec 27, 2022
VRS is a simple, minimal, free and open source static web server written in Rust

VRS is a simple, minimal, free and open source static web server written in Rust which uses absolutely no dependencies and revolves around Rust's std::net built-in utility.

null 36 Nov 8, 2022
Operator is a web server. You provide a directory and Operator serves it over HTTP.

Operator Operator is a web server. You provide a directory and Operator serves it over HTTP. It serves static files the way you'd expect, but it can a

Matt Kantor 6 Jun 6, 2022
Archibald is my attempt at learning Rust and writing a HTTP 1.1 web server.

Archibald To be a butler, is to be able to maintain an even-temper, at all times. One must have exceptional personal hygiene and look sharp and profes

Daniel Cuthbert 4 Jun 20, 2022
Salvo is a powerful and simplest web server framework in Rust world

Salvo is an extremely simple and powerful Rust web backend framework. Only basic Rust knowledge is required to develop backend services.

Salvo 1.2k Jan 5, 2023
web browser as a language server

web-browser-lsp A toy program that implements a text-based web browser as a language server. Motivation My favorite progrmming tools are neovim, tmux

octaltree 17 Nov 24, 2022
Web Server made with Rust - for learning purposes

Web Server made with Rust - for learning purposes

Lílian 2 Apr 25, 2022
Live Server - Launch a local network server with live reload feature for static pages

Live Server - Launch a local network server with live reload feature for static pages

Lomirus 18 Nov 30, 2022
Host These Things Please - a basic http server for hosting a folder fast and simply

http Host These Things Please - a basic HTTP server for hosting a folder fast and simply Selected features See the manpage for full list. Symlinks fol

thecoshman 367 Dec 23, 2022
A fast, boilerplate free, web framework for Rust

Tower Web A web framework for Rust with a focus on removing boilerplate. API Documentation Tower Web is: Fast: Fully asynchronous, built on Tokio and

Carl Lerche 969 Dec 22, 2022
OxHTTP is a very simple synchronous HTTP client and server

OxHTTP is a very simple synchronous implementation of HTTP 1.1 in Rust. It provides both a client and a server.

Oxigraph 13 Nov 29, 2022
Simple http server in Rust (Windows/Mac/Linux)

How it looks like? Screenshot Command Line Arguments Simple HTTP(s) Server 0.6.1 USAGE: simple-http-server [FLAGS] [OPTIONS] [--] [root] FLAGS:

LinFeng Qian 788 Dec 28, 2022
Akasio is a simple HTTP server that redirects traffic based on a JSON redirect table. This is its Rust implementation.

This page is inaccurate and is pending updates. Akasio (Rust) Description Akasio is a simple HTTP server that redirects traffic based on a JSON redire

K4YT3X 5 May 2, 2022
simple static file server written in Rust based on axum framework

static-server simple static file server written in Rust based on axum framework I'm learning Rust and axum. My thought is simple. axum has a static-fi

null 27 Jan 1, 2023
Create, share, fetch and model Atomic Data! This project consists of a graph database + server, a CLI and a rust library.

Create, share, fetch and model Atomic Data! This repo consists of three components: A library, a server and a CLI. atomic-server Status: Beta. Breakin

Joep Meindertsma 195 Dec 28, 2022
A flexible web framework that promotes stability, safety, security and speed.

A flexible web framework that promotes stability, safety, security and speed. Features Stability focused. All releases target stable Rust. This will n

Gotham 2.1k Jan 3, 2023
Sincere is a micro web framework for Rust(stable) based on hyper and multithreading

The project is no longer maintained! Sincere Sincere is a micro web framework for Rust(stable) based on hyper and multithreading. Style like koa. The

null 94 Oct 26, 2022
A starter template for actix-web projects that feels very Django-esque. Avoid the boring stuff and move faster.

Jelly A.K.A, the actix-web starter you probably wish you had. This is provided as-is, and anyone is free to extend it or rework it as they desire - ju

SecretKeys 198 Dec 15, 2022