Sign inSign up

thkukuk/mws

By thkukuk

Updated almost 4 years ago

Mini-Webserver (mws) - small webserver for static web pages supporting http and https written in go

Image
0

1.5K

thkukuk/mws repository overview

mws

Mini-Webserver (mws) - small webserver for static web pages supporting http and https written in go

Intro

This webserver serves static web pages via http and/or https. If no certificates are specified, temporary ones will be created on the fly for the local hostname and localhost.

The server listens by default only on port 80. If only https should be provided, this can be disabled with an empty --http="" option.

Usage

  mws [flags]
Flags
  • -d, --dir string directory to read files from (default ".")
  • -h, --help help for mws
  • --http string address to listen on for http (default ":80")
  • --https string address to listen on for https
  • --timeout-read int timeout in seconds for http read (default 5)
  • --timeout-write int timeout in seconds for http write (default 10)
  • --tls-cert string path to the certificate file for https
  • --tls-key string path to the key file for https
  • -v, --version version for mws

Container

Building your own container

To build your own container image:

sudo podman build --build-arg VERSION="$(cat VERSION)" --build-arg BUILDTIME=$(date +%Y-%m-%dT%TZ) -t mws .

Run the container image with http and https ports open, certificate is generated on the fly in memory on start:

sudo podman run -p 80:80 -p 443:443 thkukuk/mws --https :443

To specify a directory from where the static webpages are used:

sudo podman run -p 80:80 -p 443:443 -v /srv/www:/srv/www --rm --name mws thkukuk/mws --https :443 --dir /srv/www/htdocs

In this example we expect that on the host OS we have a directory structure below /srv/www which contains the web pages in the directory htdocs.

Reporting Bugs

Please report bugs as github issue https://github.com/thkukuk/mws/issues

Tag summary

Content type

Image

Digest

sha256:04f31cfca

Size

11.4 MB

Last updated

almost 4 years ago

docker pull thkukuk/mws