Sign inSign up

kevinpollet/srv

By kevinpollet

•Updated almost 5 years ago

Simple, secure and modern HTTP server to serve a static site, single-page app or a file with ease

Image
0

552

kevinpollet/srv repository overview

⁠srv

Build Status Go Report Card GoDoc Conventional Commits License

srv is a simple, secure and modern HTTP server, written in Go⁠, to serve a static site, single-page application or a file with ease. You can use it through its command-line interface, Docker⁠ image or programmatically. As it's an http.Handler implementation, it should be easy to integrate it into your application. The following key features make srv unique and differentiable from the existing solutions and the http.FileServer implementation.

  • Programmatic API.
  • HTTP/2 and TLS support.
  • Custom error handler and pages.
  • Basic HTTP authentication.
  • Hide dot files by default.
  • Directory listing is disabled by default.
  • Encoding negotiation with support of gzip⁠, Deflate⁠ and Brotli⁠ compression algorithms.

⁠Usage

The following Dockerfile shows how to use the provided base image to serve a static site, single-page application or file through a running Docker container. By default, the base image will serve all files available in the /var/www/ directory and listen for TCP connections on 8080.

FROM kevinpollet/srv:latest
COPY . /var/www/

Then, you can build and run your Docker image with the following commands. Your static site or files will be available on http://localhost:8080⁠.

docker build . -t moby:latest
docker run -d -p 8080:8080 moby:latest

⁠License

MIT⁠

Tag summary

Content type

Image

Digest

Size

7.8 MB

Last updated

almost 5 years ago

docker pull kevinpollet/srv