LinuxCommandLibrary

http-server

simple static file server

TLDR

Start server

$ http-server
copy
Specify port
$ http-server -p [8080]
copy
Specify directory
$ http-server [./public]
copy
Enable CORS
$ http-server --cors
copy
Enable gzip
$ http-server -g
copy
SSL server
$ http-server -S -C [cert.pem] -K [key.pem]
copy

SYNOPSIS

http-server [options] [path]

DESCRIPTION

http-server is a simple static file server. It serves files from a directory over HTTP with no configuration required.
The tool is useful for development, testing, and quick file sharing. It supports SSL, CORS, and basic caching.

PARAMETERS

PATH

Directory to serve.
-p, --port PORT
Port number (default 8080).
-a ADDRESS
Listen address.
-c SECONDS
Cache time.
--cors
Enable CORS headers.
-g, --gzip
Enable gzip.
-S, --ssl
Enable SSL.
--help
Display help information.

CAVEATS

Node.js package. Not for production. No authentication.

HISTORY

http-server is a popular npm package for quickly serving static files during development.

SEE ALSO

serve(1), python(1), live-server(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community