miniserve(1)

๐Ÿ’– miniserve(1) ๐Ÿ’–

okay so this is the General Commands Manual page for miniserve, bestie. it's giving "tiny http server that ate and left no crumbs" energy and honestly? we're obsessed. here's everything you need, no cap. ๐Ÿซถ


๐ŸŒธ NAME ๐ŸŒธ

miniserve โ€” for when you really just want to serve some files over HTTP right now! ๐ŸŽ€

like literally. right now. that's the whole vibe. she's not complicated, she's not doing too much, she's just serving. ๐Ÿ’…


๐ŸŒ€ SYNOPSIS ๐ŸŒ€

miniserve [-v|--verbose] [--temp-directory] [--index] [--spa] [--quiet]
[--pretty-urls] [-p|--port] [-i|--interfaces] [--workers] [-a|--auth]
[--auth-file] [--route-prefix] [--random-route] [-P|--no-symlinks]
[-H|--hidden] [-S|--default-sorting-method] [-O|--default-sorting-order]
[-c|--color-scheme] [-d|--color-scheme-dark] [-q|--qrcode]
[-u|--upload-files] [--web-upload-files-concurrency] [--chmod]
[--directory-size] [-U|--mkdir] [--pastebin] [-m|--media-type]
[-M|--raw-media-type] [-o|--on-duplicate-files] [-R|--rm-files]
[-r|--enable-tar] [-g|--enable-tar-gz] [-z|--enable-zip]
[-C|--compress-response] [-D|--dirs-first] [-t|--title] [--header]
[-l|--show-symlink-info] [-F|--hide-version-footer]
[--hide-theme-selector] [-W|--show-wget-footer] [--print-completions]
[--print-manpage] [--tls-cert] [--tls-key] [--readme]
[-I|--disable-indexing] [--enable-webdav] [--size-display]
[--file-external-url] [--log-color] [-h|--help] [-V|--version] [PATH]

that's the whole fit check. every single flag, no skips, no "you don't need this one". โœจ


๐Ÿ’… DESCRIPTION ๐Ÿ’…

for when you really just want to serve some files over HTTP right now!

that's it. that's the mission statement. no thirty-step setup arc, no config file trauma, no main-character-itis from some other server. you point miniserve at a directory (or don't โ€” it'll figure it out, see [PATH] up there ๐Ÿ‘†) and boom ๐Ÿ’ฅ there's a file listing on the other side. iconic behavior honestly.

like... you could be doing literally anything else with your life and instead you're in a terminal typing one command and now your files have a URL. that's the whole plot twist. ๐Ÿฆ‹


okay but fr fr, there are a ton of options hiding behind that synopsis, and we're getting into all of them โ€” every flag, every default, every env var, every warning, all of it. nothing gets left on read. ๐Ÿ’€

๐Ÿซถ to be continued... ๐Ÿ’–

โœจ OPTIONS โœจ

okay bestie, this is the big one, the whole menu of vibes you can hand to miniserve. every single flag, no skips, no shortcuts, periodt. ๐Ÿ’…

  • -v, --verbose โ€” be loud about what's happening, and yeah that includes spitting out access logs so you can see who's knocking.
  • --temp-directory <TEMP_UPLOAD_DIRECTORY> โ€” where uploaded files get parked before they're moved to their forever home. ngl it's wise to make sure this directory actually writes to disk and not into memory, because surprise, memory is not a filing cabinet.

this value only gets used IF file uploading is turned on. if you don't set it, the OS's default temporary directory gets the job instead.

  • --index <INDEX> โ€” the name of a directory index file to serve, like "index.html".

so normally, when miniserve serves a directory, it just makes a listing for it, cute little browse vibe. but if that directory contains this file, miniserve serves that file instead. slay.

  • --spa โ€” activates SPA (Single Page Application) mode.

this makes the file you gave to --index get served for all non-existing file paths. basically, whenever a 404 would've happened, it serves the index file instead so the SPA router can handle the request itself. the 404 could never. ๐Ÿ˜Œ

  • --quiet โ€” less output, and it shushes the warnings. it's givingโ€ฆ silence, on purpose.
  • --pretty-urls โ€” activates Pretty URLs mode.

this makes the server serve the equivalent .html file that the path is pointing at. so:

/about will try to find about.html and serve it. โœจ

  • -p, --port <PORT> [default: 8080] โ€” the port to use. that's it, that's the whole thing.
  • -i, --interfaces <INTERFACES> โ€” which interface to listen on.
  • --workers <WORKERS> [default: 4] โ€” how many server workers you want grinding. yes bestie, we're working.
  • -a, --auth <AUTH> โ€” set authentication, i.e. put a little lock on the door.

the formats supported rn: username:password, username:sha256:hash, username:sha512:hash. for example: joe:123, joe:sha256:a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3. ๐Ÿ”

  • --auth-file <AUTH_FILE> โ€” read your authentication values from a file instead, so your secrets don't live directly on the command line where everyone can see them.

example file content:

joe:123
bob:sha256:a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3
bill:

(yes, bill: with nothing after it. that's allowed, we don't judge bill.)

  • --route-prefix <ROUTE_PREFIX> โ€” use a specific route prefix. make it yours. ๐Ÿ’–
  • --random-route โ€” generates a random 6-hexdigit route. chaotic, unguessable, iconic.
  • -P, --no-symlinks โ€” hides symlinks from the listing AND prevents them from being followed. they're not invited to this party.
  • -H, --hidden โ€” show hidden files. the ones with the little dot. we see them now. ๐Ÿซฃ
  • -S, --default-sorting-method <DEFAULT_SORTING_METHOD> [default: name] โ€” the default way the file list gets sorted.

possible values:

  • name: sort by name
  • size: sort by size
  • date: sort by last modification date (natural sort: follows alphanumerical order)
  • -O, --default-sorting-order <DEFAULT_SORTING_ORDER> [default: desc] โ€” the default sorting order for the file list.

possible values:

  • asc: ascending order
  • desc: descending order
  • -c, --color-scheme <COLOR_SCHEME> [default: squirrel] โ€” the default color scheme. aesthetic matters, fr fr.

possible values:

  • squirrel
  • archlinux
  • ayu-dark
  • zenburn
  • monokai
  • -d, --color-scheme-dark <COLOR_SCHEME_DARK> [default: archlinux] โ€” default color scheme, but for dark mode hours. ๐ŸŒ™

possible values:

  • squirrel
  • archlinux
  • ayu-dark
  • zenburn
  • monokai
  • -q, --qrcode โ€” enable QR code display, so you can beam the URL to your phone like a lil magical girl. ๐Ÿ“ฑโœจ
  • -u, --upload-files [<ALLOWED_UPLOAD_DIR>] โ€” enable file uploading, and optionally say which directory people can upload into.

okay important detail: the path you provide here is not a physical file system path. it's relative to the serve dir. for instance, if the serve dir is /home/hello, set this to /upload to allow uploading to /home/hello/upload. and heads up โ€” when you specify it via an environment variable, a path always needs to be specified.

  • --web-upload-files-concurrency <WEB_UPLOAD_CONCURRENCY> [default: 0] โ€” how many uploads can happen at the same time when someone's using the website. you need the upload-files option enabled for this to even matter.

for example, a value of 4 would mean the web browser only uploads 4 files at a time to the web server when using the browser interface.

when the value stays at 0, it attempts to resolve all the uploads at once in the web browser.

NOTE: web pages have a limit on how many active HTTP connections they can make at one time, so even if you set a concurrency limit of 100, the browser might only make progress on the max amount of connections it's allowed to have open for that page. browser said "i have limits bestie". ๐Ÿ’€
  • --chmod <CHMOD> โ€” set unix file permissions for uploaded files.

this takes an octal number, for example 0600. by default 0666 & ~umask is used, to simulate the system's default behavior.

  • --directory-size โ€” enable recursive directory size calculation.

this is disabled by default because it's a potentially fairly IO intensive operation. it's giving heavy lifting, so we keep it off unless you ask. ๐Ÿ˜ฎโ€๐Ÿ’จ

  • -U, --mkdir โ€” enable creating directories. build your little folder empire.
  • --pastebin โ€” enable creating pastebin 'pastes'.

'pastes' are plaintext files created in the current directory. creating them requires file uploads to be enabled.

  • -m, --media-type <MEDIA_TYPE> โ€” specify which media types are uploadable.

possible values:

  • image
  • audio
  • video
  • -M, --raw-media-type <MEDIA_TYPE_RAW> โ€” directly specify the uploadable media type expression. you're bypassing the vibes and writing the raw thing yourself. respect.
  • -o, --on-duplicate-files <ON_DUPLICATE_FILES> [default: error] โ€” what to do when a file with the same name already exists during upload.

if you enable renaming files, the renaming happens by adding a numerical suffix to the filename before the final extension. for example file.txt will be uploaded as file-1.txt, and the number keeps increasing until an available filename is found. cute, right?

possible values:

  • error
  • overwrite
  • rename
  • -R, --rm-files [<ALLOWED_RM_DIR>] โ€” enable file and directory deletion, and optionally specify which directory that's allowed in. with great power etc etc. โš ๏ธ
  • -r, --enable-tar โ€” enable uncompressed tar archive generation.
  • -g, --enable-tar-gz โ€” enable gz-compressed tar archive generation.
  • -z, --enable-zip โ€” enable zip archive generation.
WARNING: zipping large directories can result in an out-of-memory exception, because zip generation is done in memory and cannot be sent on the fly. so likeโ€ฆ small zips only bestie, we're begging. ๐Ÿ˜ญ
  • -C, --compress-response โ€” compress the response.
WARNING: enabling this option may slow down transfers due to CPU overhead, so it's disabled by default.

only enable this option if you know your users have slow connections, or if you want to minimize your server's bandwidth usage. otherwise you're just making the CPU do cardio for no reason.

  • -D, --dirs-first โ€” list directories first. folders get the front row seats. ๐Ÿ‘‘
  • -t, --title <TITLE> โ€” shown instead of the host in the page title and heading. rename your whole vibe.
  • --header <HEADER> โ€” inserts custom headers into the responses. specify each header as a 'Header:Value' pair. this parameter can be used multiple times to add multiple headers.

example: --header "Header1:Value1" --header "Header2:Value2" (if a header is already set or was previously inserted, it will not be overwritten.)

  • -l, --show-symlink-info โ€” visualize symlinks in the directory listing. we love a transparent queen. ๐Ÿฆ‹
  • -F, --hide-version-footer โ€” hide the version footer.
  • --hide-theme-selector โ€” hide the theme selector.
  • -W, --show-wget-footer โ€” if enabled, display a wget command to recursively download the current directory.
  • --print-completions <shell> โ€” generate a completion file for a shell.

possible values:

  • bash
  • elvish
  • fish
  • powershell
  • zsh
  • --print-manpage โ€” generate man page. she's self-aware. ๐Ÿ’…
  • --tls-cert <TLS_CERT> โ€” the TLS certificate to use.
  • --tls-key <TLS_KEY> โ€” the TLS private key to use.
  • --readme โ€” enable README.md rendering in directories. finally, your readme gets its main character moment.
  • -I, --disable-indexing โ€” disable indexing.

this will prevent directory listings from being generated and return an error instead. no peeking. ๐Ÿ”’

  • --enable-webdav โ€” enable read-only WebDAV support (PROPFIND requests).
  • --size-display <SIZE_DISPLAY> [default: human] โ€” show served file size inโ€ฆ well, that depends.

possible values:

  • human
  • exact

this allows serving files from a different URL than the browsing instance. super useful for setups like: one authenticated instance for browsing, linking files (via this option) to a second, non-indexed (-I) instance for direct downloads. this obscures the full file list on the download server, while users can still copy direct file URLs for sharing. the external URL is put verbatim in front of the relative location of the file, including the protocol. the user should take care this results in a valid URL โ€” no further checks are being done. so like, that's on you. ๐Ÿ™ˆ

  • --log-color <LOG_COLOR> [default: auto] โ€” set the color style of the log output.

"auto" (default) enables colors only when the output is a terminal. "always" always enables colors. "never" always disables colors.

possible values:

  • auto
  • always
  • never
  • -h, --help โ€” print help (see a summary with '-h').
  • -V, --version โ€” print version.
  • [PATH] โ€” which path to serve. the whole point, honestly. ๐ŸŽ€

๐ŸŒˆ VERSION ๐ŸŒˆ

v0.35.0 โ€” that's the one, bestie.

๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

  • Sven-Hendrik Haase <svenstaro@gmail.com>
  • Boastful Squirrel <boastful.squirrel@gmail.com>

and that's the whole page, we ate and left no crumbs. ๐Ÿ’– this was miniserve version 0.35.0, documented as miniserve(1) โ€” go forth and serve files, you gorgeous genius. no cap. ๐Ÿซถโœจ

๐Ÿ“ฆ where this page comes from