Skip to content

reedobrien/dserve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

dserve

A simple server which may be used for local development, fileserving, or whatever.

Install

go get github.com/reedobrien/dserve

Usage

dserve
  -address string
    	The address to listen on (default "127.0.0.1")
  -cert string
    	The TLS certificate to use (default "cert.pem")
  -key string
    	The TLS key to use. (default "key.pem")
  -path string
    	Path to the document root
  -port string
    	The port to listen on (default "8080")
  -tls
    	Use TLS

Serve the current directory on localhost port 8080:

dserve

Serve the current directory with TLS on localhost port 8443:

dserve -tls

You can generate certs suitable with the generate_cert.go tool in go's crypto/tls package:

go run /usr/local/go/src/crypto/tls/generate_cert.go --host localhost

Alternatively you can generate a cert/key pair with openssl something like this:

openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 3650 -nodes

Run on all listening addresses:

dserve -address 0.0.0.0

Apache logging was originally lifted from this gist and modified slightly to add elapsed time.

About

An http server for serving a directory locally

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages