A simple HTTP file server in a single executable file.
- Download the binary for your platform from here.
- Move the binary to an installation directory of your choice.
- Add the installation directory to your environment path.
cd root/of/project/you/want/to/serve
serveit
serveit -port=7070
serveit -not-found-file=404.html
For single-page applications, this flag is typically set to index.html
.
Serveit makes it simple to serve files over HTTPS by automatically creating self-signed certificates:
serveit -tls
This command automatically generates the following files if they don't already exist:
serveit_root_ca.key |
Private key for Root Certificate Aurthority. |
serveit_root_ca.crt |
Public certificate for Root Certificate Aurthority. |
serveit.key |
Private key for server. |
serveit.crt |
Public certificate for server, signed with serveit_root_ca.key and serveit_root_ca.crt . |
Install serveit_root_ca.crt
as a Trusted Root Certificate Authority in your
client device to have the browser trust the connection to serveit at
https://localhost:8080
.
Create certificate for IP address:
serveit -tls -hosts 192.168.0.1
Create certificate for domain name:
serveit -tls -hosts example.com
Create certificate for multiple domain names or IP addresses:
serveit -tls -hosts localhost,192.168.0.1,example.com
Serve on default HTTPS port (443):
serveit -tls -hosts example.com -port 443
- Go
- GNU Make
- Text editor (Recommended: VSCode with Go extension)
make build
make test