nanoHttp is a lightweight HTTP server manager that allows you to run multiple HTTP server instances on different ports. It's designed to be simple to use while providing essential features for serving static files.
- Run multiple HTTP server instances on different ports
- Configuration management at
~/.nanoHttp/config
- Customizable instance settings:
- Port number (default: 8080)
- Web root folder
- Directory listing (optional)
- Instance management (add, delete, start, stop)
- Process tracking with PID management
- Enhanced display options:
- Table format with status colors
- Simple format for detailed view
- Self-update capability
- Simple CLI interface with comprehensive help system
curl -fsSL https://nanohttp.mguptahub.com/install.sh | bash
This will automatically detect your OS and architecture, download the appropriate binary, and install it to /usr/local/bin
.
If you prefer to install manually, you can download the binary directly:
# For AMD64
curl -L -o nanoHttp https://github.com/mguptahub/nanoHttp/releases/latest/download/nanoHttp-linux-amd64
# For ARM64
curl -L -o nanoHttp https://github.com/mguptahub/nanoHttp/releases/latest/download/nanoHttp-linux-arm64
# Make it executable
chmod +x nanoHttp
# Move to a directory in your PATH
sudo mv nanoHttp /usr/local/bin/
# For Intel (AMD64)
curl -L -o nanoHttp https://github.com/mguptahub/nanoHttp/releases/latest/download/nanoHttp-darwin-amd64
# For Apple Silicon (ARM64)
curl -L -o nanoHttp https://github.com/mguptahub/nanoHttp/releases/latest/download/nanoHttp-darwin-arm64
# Make it executable
chmod +x nanoHttp
# Move to a directory in your PATH
sudo mv nanoHttp /usr/local/bin/
nanoHttp provides a simple command-line interface. Use --help
with any command to see detailed usage information:
# Show general help
nanoHttp --help
# Show help for specific commands
nanoHttp add --help
nanoHttp start --help
nanoHttp stop --help
nanoHttp delete --help
nanoHttp list --help
nanoHttp update --help
nanoHttp version --help
# Basic usage with required flags
nanoHttp add -name myserver -web-folder /path/to/files
# Full usage with all options
nanoHttp add -name myserver \
-port 8080 \
-web-folder /path/to/files \
-allow-dir-listing
# Start an instance
nanoHttp start myserver
# Stop an instance
nanoHttp stop myserver
# Delete an instance
nanoHttp delete myserver
# List all instances (table format)
nanoHttp list
# List all instances with detailed view
nanoHttp list --simple
The list command provides two display formats:
- Default table format: Compact view with color-coded status
- Simple format (
--simple
): Detailed view showing full paths and information
# Check for updates
nanoHttp update
# Show version
nanoHttp version
The configuration file is stored at ~/.nanoHttp/config
in JSON format. Here's an example configuration:
{
"instances": {
"myserver": {
"name": "myserver",
"port": 8080,
"web_folder": "/path/to/files",
"allow_dir_listing": true,
"is_running": false
}
}
}
# Clone the repository
git clone https://github.com/mguptahub/nanoHttp.git
cd nanoHttp
# Build the binary
go build -o nanoHttp cmd/nanoHttp/main.go
-name
(required): Instance name-port
(default: 8080): Port number-web-folder
(required): Web root folder-allow-dir-listing
(default: false): Allow directory listing
start <instance-name>
: Start an instancestop <instance-name>
: Stop an instancedelete <instance-name>
: Delete an instancelist
: List all instancesupdate
: Check for updatesversion
: Show version information
MIT License
Contributions are welcome! Please feel free to submit a Pull Request.