Serve Files & Directories
Share files and directories instantly over HTTPS with a public URL
Basic Usage
The ngsrv serve command creates a simple file server with directory browsing.
ngsrv serve [directory]If no directory is specified, serves the current directory
Examples
Serve current directory
ngsrv serveServes all files in the current directory with directory listing
Serve specific directory
ngsrv serve ./publicServes only files in the ./public directory
With custom domain
ngsrv serve ./docs --domain mydocsServes docs folder at mydocs.tnl.ngsrv.com
With password protection
ngsrv serve ./files --policy ngsrv_auth_ABC123Requires header authentication to access files
Pin the local port (e.g. for predictable dashboards)
ngsrv serve ./public --port 8080Runs the in-process file server on localhost:8080 instead of a random port.
Replace an existing tunnel on the same domain
ngsrv serve ./public --domain mydocs --forceTerminates any existing tunnel bound to mydocs before starting this one.
Flags
| Flag | Description | Default |
|---|---|---|
| --domain, -d | Domain to use (subdomain name or full FQDN). | team default / random |
| --port, -p | Local port for the in-process file server. | random |
| --force, -f | Terminate any existing tunnel on the same domain before starting. | false |
| --policy | Security policy ID to apply. Repeat the flag to apply several. | none |
Features
Directory Browsing
Automatic directory listing with file sizes and last modified dates
MIME Type Detection
Automatically sets correct content types for all file formats
HTTPS by Default
All file transfers are encrypted over HTTPS
Range Requests
Supports partial content delivery for large files and video streaming
Common Use Cases
Quick File Sharing
Share project files with remote team members without email attachments
Static Site Preview
Preview static HTML/CSS/JS sites before deploying to production
Documentation Sharing
Share generated documentation (like JSDoc or Sphinx output) with stakeholders
Build Artifact Distribution
Temporarily share compiled binaries or build artifacts for testing
Security Considerations
⚠️ Important
- • All files in the directory become publicly accessible
- • Use security policies to restrict access
- • Don't serve directories containing sensitive data
- • Consider using
--policyfor authentication
Recommended Security Policies
- • IP Security - Restrict to known IPs
- • Header Authentication - Require password
- • Time-Based Access - Limit to business hours