GoHTTP
A simple HTTP file server that allows browsing directories and uploading files via a web interface or command line tools.
Features
- Serve files from a specified directory
- Support for file uploads and downloads
- Basic authentication for secure access
- Upload files via the web interface or with curl
- TLS encryption with either provided certificates or auto-generated self-signed certificates
Installation
Using Go
go install github.com/Gubarz/GoHTTP@latest
From Source
git clone https://github.com/Gubarz/GoHTTP.git
cd GoHTTP
go build
Usage
Basic Server
Start a basic server on port 8080 serving the current directory:
GoHTTP
Command Line Options
Usage: GoHTTP [flags]
Flags:
-a, --auth string Optional basic auth in user:pass format
-c, --cert string TLS cert file (optional)
-d, --dir string Base directory to serve (default ".")
-h, --help help for GoHTTP
-k, --key string TLS key file (optional)
-p, --port string Port to listen on (default "8080")
-t, --tls Enable HTTPS (self-signed if cert/key not provided)
Examples
Serve a Specific Directory on a Custom Port
GoHTTP --dir /path/to/serve --port 9000
Enable Basic Authentication
GoHTTP --auth username:password
Use TLS with Auto-Generated Certificates
GoHTTP --tls
Use TLS with Custom Certificates
GoHTTP --tls --cert mycert.pem --key mykey.pem
File Uploads
Via Web Interface
Navigate to any directory in your browser and use the upload form at the bottom of the page.
Via Command Line
Upload a file using curl:
curl -F '[email protected]' http://localhost:8080/
With authentication:
curl -F '[email protected]' -u username:password http://localhost:8080/