gowebhello is a simple golang replacement for 'python -m SimpleHTTPServer'. gowebhello can also be configured as an HTTPS web server using SSL certificates.
If you want to use TLS, you will need a certificate:
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout key.pem -out cert.pem
# make sure GOPATH is either unset or properly set
go get github.com/udhos/gowebhello
go install github.com/udhos/gowebhello
git clone https://github.com/udhos/gowebhello ;# clone outside of GOPATH
cd gowebhello
go install ./gowebhello
Use the '-h' switch to get command line help.
$ gowebhello -h
Enable TLS by providing a certificate. If you enable TLS, HTTP port will be redirected to HTTPS port.
$ ~/go/bin/gowebhello
2017/06/08 11:24:03 registering static directory /home/lab/go/src/github.com/udhos/gowebhello as www path /www/
2017/06/08 11:24:03 using TCP ports HTTP=:8080 HTTPS=:8443 TLS=true
2017/06/08 11:24:03 installing redirect from HTTP=:8080 to HTTPS=8443
2017/06/08 11:24:03 serving HTTPS on TCP :8443
Then open https://localhost:8443
If you do not provide a certificate, TLS will be disabled.
$ ~/go/bin/gowebhello -cert=badcert
2017/06/08 11:25:01 TLS cert file not found: badcert - disabling TLS
2017/06/08 11:25:01 registering static directory /home/lab/go/src/github.com/udhos/gowebhello as www path /www/
2017/06/08 11:25:01 using TCP ports HTTP=:8080 HTTPS=:8443 TLS=false
2017/06/08 11:25:01 serving HTTP on TCP :8080
Then open http://localhost:8080
You can disable HTTP by specifying the same port to both -addr and -httpsAddr.
$ ~/go/bin/gowebhello -addr :8443 -httpsAddr :8443
2017/06/08 11:25:46 registering static directory /home/lab/go/src/github.com/udhos/gowebhello as www path /www/
2017/06/08 11:25:46 using TCP ports HTTP=:8443 HTTPS=:8443 TLS=true
2017/06/08 11:25:46 serving HTTPS on TCP :8443
Find a small container image for gowebhello as udhos/web-scratch
here:
https://hub.docker.com/r/udhos/web-scratch
#END