commands.sh

http-server

all

Simple static HTTP server to serve static files.

More info →

Options (5)

-p, --portboolean

Start an HTTP server on a specific port to serve a specific directory

Example: http-server {{path/to/directory}} {{[-p|--port]}} {{port}}
-S, --sslboolean

Start an HTTPS server on the default port using the specified certificate

Example: http-server {{[-S|--ssl]}} {{[-C|--cert]}} {{path/to/cert.pem}} {{[-K|--key]}} {{path/to/key.pem}}
-C, --certboolean

Start an HTTPS server on the default port using the specified certificate

Example: http-server {{[-S|--ssl]}} {{[-C|--cert]}} {{path/to/cert.pem}} {{[-K|--key]}} {{path/to/key.pem}}
-K, --keyboolean

Start an HTTPS server on the default port using the specified certificate

Example: http-server {{[-S|--ssl]}} {{[-C|--cert]}} {{path/to/cert.pem}} {{[-K|--key]}} {{path/to/key.pem}}
-s, --silentboolean

Start an HTTP server with logging disabled

Example: http-server {{[-s|--silent]}}

Examples (8)

Start an HTTP server listening on the default port to serve the current directory

Start an HTTP server on a specific port to serve a specific directory

http-server path/to/directory [-p|--port] port

Start an HTTP server using basic authentication

http-server --username username --password password

Start an HTTP server with directory listings disabled

Start an HTTPS server on the default port using the specified certificate

http-server [-S|--ssl] [-C|--cert] path/to/cert.pem [-K|--key] path/to/key.pem

Start an HTTP server and include the client's IP address in the output logging

http-server --log-ip

Start an HTTP server with CORS enabled by including the `Access-Control-Allow-Origin: *` header in all responses

Start an HTTP server with logging disabled

http-server [-s|--silent]
made by @shridhargupta | data from tldr-pages