{"id":13437517,"url":"https://github.com/svenstaro/miniserve","last_synced_at":"2025-05-13T16:10:08.721Z","repository":{"id":37359652,"uuid":"131135585","full_name":"svenstaro/miniserve","owner":"svenstaro","description":"🌟 For when you really just want to serve some files over HTTP right now!","archived":false,"fork":false,"pushed_at":"2025-05-01T19:50:35.000Z","size":3866,"stargazers_count":6593,"open_issues_count":80,"forks_count":316,"subscribers_count":48,"default_branch":"master","last_synced_at":"2025-05-01T20:34:51.898Z","etag":null,"topics":["cli","command-line","command-line-tool","http-server","serve","server","static-files"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/svenstaro.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"svenstaro"}},"created_at":"2018-04-26T09:52:56.000Z","updated_at":"2025-05-01T19:50:33.000Z","dependencies_parsed_at":"2022-07-08T07:43:44.027Z","dependency_job_id":"cbbf753f-55f7-42ed-a43c-ef79ae4ab53a","html_url":"https://github.com/svenstaro/miniserve","commit_stats":{"total_commits":1436,"total_committers":60,"mean_commits":"23.933333333333334","dds":0.6511142061281336,"last_synced_commit":"41212e57e1c7cc131496b0aadb6b74ed7f5d8e10"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svenstaro%2Fminiserve","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svenstaro%2Fminiserve/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svenstaro%2Fminiserve/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svenstaro%2Fminiserve/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/svenstaro","download_url":"https://codeload.github.com/svenstaro/miniserve/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253980055,"owners_count":21994042,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","command-line","command-line-tool","http-server","serve","server","static-files"],"created_at":"2024-07-31T03:00:57.926Z","updated_at":"2025-05-13T16:10:03.675Z","avatar_url":"https://github.com/svenstaro.png","language":"Rust","funding_links":["https://github.com/sponsors/svenstaro"],"categories":["Rust","Servers","Applications","应用程序 Applications","Software","应用 Applications","Command line - Linux","Catalog","应用","server","cli","Network Tools"],"sub_categories":["Standalone","Web Servers","Web服务器 Web Servers","File Transfer - Web-based File Managers","网络服务端 Web Servers","Learning resources","network","Web 服务器"],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"data/logo.svg\" alt=\"miniserve - a CLI tool to serve files and dirs over HTTP\"\u003e\u003cbr\u003e\n\u003c/p\u003e\n\n# miniserve - a CLI tool to serve files and dirs over HTTP\n\n[![CI](https://github.com/svenstaro/miniserve/workflows/CI/badge.svg)](https://github.com/svenstaro/miniserve/actions)\n[![Docker Hub](https://img.shields.io/docker/pulls/svenstaro/miniserve)](https://cloud.docker.com/repository/docker/svenstaro/miniserve/)\n[![Crates.io](https://img.shields.io/crates/v/miniserve.svg)](https://crates.io/crates/miniserve)\n[![license](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/svenstaro/miniserve/blob/master/LICENSE)\n[![Stars](https://img.shields.io/github/stars/svenstaro/miniserve.svg)](https://github.com/svenstaro/miniserve/stargazers)\n[![Downloads](https://img.shields.io/github/downloads/svenstaro/miniserve/total.svg)](https://github.com/svenstaro/miniserve/releases)\n[![Lines of Code](https://tokei.rs/b1/github/svenstaro/miniserve)](https://github.com/svenstaro/miniserve)\n\n**For when you really just want to serve some files over HTTP right now!**\n\n**miniserve** is a small, self-contained cross-platform CLI tool that allows you to just grab the binary and serve some file(s) via HTTP.\nSometimes this is just a more practical and quick way than doing things properly.\n\n## Screenshot\n\n![Screenshot](screenshot.png)\n\n## How to use\n\n### Serve a directory:\n\n    miniserve linux-distro-collection/\n\n### Serve a single file:\n\n    miniserve linux-distro.iso\n\n### Set a custom index file to serve instead of a file listing:\n\n    miniserve --index test.html\n\n### Serve an SPA (Single Page Application) so that non-existent paths are forwarded to the SPA's router instead\n\n    miniserve --spa --index index.html\n\n### Require username/password:\n\n    miniserve --auth joe:123 unreleased-linux-distros/\n\n### Require username/password as hash:\n\n    pw=$(echo -n \"123\" | sha256sum | cut -f 1 -d ' ')\n    miniserve --auth joe:sha256:$pw unreleased-linux-distros/\n\n### Require username/password from file (separate logins with new lines):\n\n    miniserve --auth-file auth.txt unreleased-linux-distros/\n\n### Generate random 6-hexdigit URL:\n\n    miniserve -i 192.168.0.1 --random-route /tmp\n    # Serving path /private/tmp at http://192.168.0.1/c789b6\n\n### Bind to multiple interfaces:\n\n    miniserve -i 192.168.0.1 -i 10.13.37.10 -i ::1 /tmp/myshare\n\n### Insert custom headers\n\n    miniserve --header \"Cache-Control:no-cache\" --header \"X-Custom-Header:custom-value\" -p 8080 /tmp/myshare\n    # Check headers in another terminal\n    curl -I http://localhost:8080\n\nIf a header is already set or previously inserted, it will not be overwritten.\n\n### Start with TLS:\n\n    miniserve --tls-cert my.cert --tls-key my.key /tmp/myshare\n    # Fullchain TLS and HTTP Strict Transport Security (HSTS)\n    miniserve --tls-cert fullchain.pem --tls-key my.key --header \"Strict-Transport-Security: max-age=31536000; includeSubDomains; preload\" /tmp/myshare\n\nIf the parameter value has spaces, be sure to wrap it in quotes.\n(To achieve an A+ rating at https://www.ssllabs.com/ssltest/, enabling both fullchain TLS and HSTS is necessary.)\n\n### Upload a file using `curl`:\n\n    # in one terminal\n    miniserve -u -- .\n    # in another terminal\n    curl -F \"path=@$FILE\" http://localhost:8080/upload\\?path\\=/\n\n(where `$FILE` is the path to the file. This uses miniserve's default port of 8080)\n\nNote that for uploading, we have to use `--` to disambiguate the argument to `-u`.\nThis is because `-u` can also take a path (or multiple). If a path argument to `-u` is given,\nuploading will only be possible to the provided paths as opposed to every path.\n\nAnother effect of this is that you can't just combine flags like this `-uv` when `-u` is used. In\nthis example, you'd need to use `-u -v`.\n\n### Create a directory using `curl`:\n\n    # in one terminal\n    miniserve --upload-files --mkdir .\n    # in another terminal\n    curl -F \"mkdir=$DIR_NAME\" http://localhost:8080/upload\\?path=\\/\n\n(where `$DIR_NAME` is the name of the directory. This uses miniserve's default port of 8080.)\n\n### Use the raw renderer for use with simple viewers\n\nYou can pass `?raw=true` with requests where you only require minimal HTML output for CLI-based browsers such as `lynx` or `w3m`.\nThis is enabled by default without any extra flags:\n\n    miniserve .\n    curl http://localhost:8080?raw=true\n\nYou can enable a convenient copy-pastable footer for `wget` using `--show-wget-footer`:\n\n    miniserve --show-wget-footer .\n\nAfterwards, check the bottom of any rendered page.\nIt'll have a neat `wget` command you can easily copy-paste to recursively grab the current directory.\n\n### Take pictures and upload them from smartphones:\n\n    miniserve -u -m image -q\n\nThis uses the `--media-type` option, which sends a hint for the expected media type to the browser.\nSome mobile browsers like Firefox on Android will offer to open the camera app when seeing this.\n\n## Features\n\n- Easy to use\n- Just works: Correct MIME types handling out of the box\n- Single binary drop-in with no extra dependencies required\n- Authentication support with username and password (and hashed password)\n- Mega fast and highly parallel (thanks to [Rust](https://www.rust-lang.org/) and [Actix](https://actix.rs/))\n- Folder download (compressed on the fly as `.tar.gz` or `.zip`)\n- File uploading\n- Directory creation\n- Pretty themes (with light and dark theme support)\n- Scan QR code for quick access\n- Shell completions\n- Sane and secure defaults\n- TLS (for supported architectures)\n- Supports README.md rendering like on GitHub\n- Range requests\n- WebDAV support\n- Healthcheck route (at `/__miniserve_internal/healthcheck`)\n\n## Usage\n\n```\nFor when you really just want to serve some files over HTTP right now!\n\nUsage: miniserve [OPTIONS] [PATH]\n\nArguments:\n  [PATH]\n          Which path to serve\n\n          [env: MINISERVE_PATH=]\n\nOptions:\n  -v, --verbose\n          Be verbose, includes emitting access logs\n\n          [env: MINISERVE_VERBOSE=]\n\n      --index \u003cINDEX\u003e\n          The name of a directory index file to serve, like \"index.html\"\n\n          Normally, when miniserve serves a directory, it creates a listing for that directory. However, if a\n          directory contains this file, miniserve will serve that file instead.\n\n          [env: MINISERVE_INDEX=]\n\n      --spa\n          Activate SPA (Single Page Application) mode\n\n          This will cause the file given by --index to be served for all non-existing file paths. In effect,\n          this will serve the index file whenever a 404 would otherwise occur in order to allow the SPA\n          router to handle the request instead.\n\n          [env: MINISERVE_SPA=]\n\n      --pretty-urls\n          Activate Pretty URLs mode\n\n          This will cause the server to serve the equivalent `.html` file indicated by the path.\n\n          `/about` will try to find `about.html` and serve it.\n\n          [env: MINISERVE_PRETTY_URLS=]\n\n  -p, --port \u003cPORT\u003e\n          Port to use\n\n          [env: MINISERVE_PORT=]\n          [default: 8080]\n\n  -i, --interfaces \u003cINTERFACES\u003e\n          Interface to listen on\n\n          [env: MINISERVE_INTERFACE=]\n\n  -a, --auth \u003cAUTH\u003e\n          Set authentication\n\n          Currently supported formats:\n          username:password, username:sha256:hash, username:sha512:hash\n          (e.g. joe:123, joe:sha256:a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3)\n\n          [env: MINISERVE_AUTH=]\n\n      --auth-file \u003cAUTH_FILE\u003e\n          Read authentication values from a file\n\n          Example file content:\n\n          joe:123\n          bob:sha256:a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3\n          bill:\n\n          [env: MINISERVE_AUTH_FILE=]\n\n      --route-prefix \u003cROUTE_PREFIX\u003e\n          Use a specific route prefix\n\n          [env: MINISERVE_ROUTE_PREFIX=]\n\n      --random-route\n          Generate a random 6-hexdigit route\n\n          [env: MINISERVE_RANDOM_ROUTE=]\n\n  -P, --no-symlinks\n          Hide symlinks in listing and prevent them from being followed\n\n          [env: MINISERVE_NO_SYMLINKS=]\n\n  -H, --hidden\n          Show hidden files\n\n          [env: MINISERVE_HIDDEN=]\n\n  -S, --default-sorting-method \u003cDEFAULT_SORTING_METHOD\u003e\n          Default sorting method for file list\n\n          [env: MINISERVE_DEFAULT_SORTING_METHOD=]\n          [default: name]\n\n          Possible values:\n          - name: Sort by name\n          - size: Sort by size\n          - date: Sort by last modification date (natural sort: follows alphanumerical order)\n\n  -O, --default-sorting-order \u003cDEFAULT_SORTING_ORDER\u003e\n          Default sorting order for file list\n\n          [env: MINISERVE_DEFAULT_SORTING_ORDER=]\n          [default: desc]\n\n          Possible values:\n          - asc:  Ascending order\n          - desc: Descending order\n\n  -c, --color-scheme \u003cCOLOR_SCHEME\u003e\n          Default color scheme\n\n          [env: MINISERVE_COLOR_SCHEME=]\n          [default: squirrel]\n          [possible values: squirrel, archlinux, zenburn, monokai]\n\n  -d, --color-scheme-dark \u003cCOLOR_SCHEME_DARK\u003e\n          Default color scheme\n\n          [env: MINISERVE_COLOR_SCHEME_DARK=]\n          [default: archlinux]\n          [possible values: squirrel, archlinux, zenburn, monokai]\n\n  -q, --qrcode\n          Enable QR code display\n\n          [env: MINISERVE_QRCODE=]\n\n  -u, --upload-files [\u003cALLOWED_UPLOAD_DIR\u003e]\n          Enable file uploading (and optionally specify for which directory)\n\n          The provided path is not a physical file system path. Instead, it's relative to the serve dir. For\n          instance, if the serve dir is '/home/hello', set this to '/upload' to allow uploading to\n          '/home/hello/upload'. When specified via environment variable, a path always needs to be specified.\n\n          [env: MINISERVE_ALLOWED_UPLOAD_DIR=]\n\n      --web-upload-files-concurrency \u003cWEB_UPLOAD_CONCURRENCY\u003e\n          Configure amount of concurrent uploads when visiting the website. Must have upload-files option enabled for this setting to matter.\n\n          [env: MINISERVE_WEB_UPLOAD_CONCURRENCY=]\n          [default: 0]\n\n  -U, --mkdir\n          Enable creating directories\n\n          [env: MINISERVE_MKDIR_ENABLED=]\n\n  -m, --media-type \u003cMEDIA_TYPE\u003e\n          Specify uploadable media types\n\n          [env: MINISERVE_MEDIA_TYPE=]\n          [possible values: image, audio, video]\n\n  -M, --raw-media-type \u003cMEDIA_TYPE_RAW\u003e\n          Directly specify the uploadable media type expression\n\n          [env: MINISERVE_RAW_MEDIA_TYPE=]\n\n  -o, --overwrite-files\n          Enable overriding existing files during file upload\n\n          [env: MINISERVE_OVERWRITE_FILES=]\n\n  -r, --enable-tar\n          Enable uncompressed tar archive generation\n\n          [env: MINISERVE_ENABLE_TAR=]\n\n  -g, --enable-tar-gz\n          Enable gz-compressed tar archive generation\n\n          [env: MINISERVE_ENABLE_TAR_GZ=]\n\n  -z, --enable-zip\n          Enable zip archive generation\n\n          WARNING: Zipping large directories can result in out-of-memory exception because zip generation is\n          done in memory and cannot be sent on the fly\n\n          [env: MINISERVE_ENABLE_ZIP=]\n\n  -C, --compress-response\n          Compress response\n\n          WARNING: Enabling this option may slow down transfers due to CPU overhead, so it is disabled by\n          default.\n\n          Only enable this option if you know that your users have slow connections or if you want to\n          minimize your server's bandwidth usage.\n\n          [env: MINISERVE_COMPRESS_RESPONSE=]\n\n  -D, --dirs-first\n          List directories first\n\n          [env: MINISERVE_DIRS_FIRST=]\n\n  -t, --title \u003cTITLE\u003e\n          Shown instead of host in page title and heading\n\n          [env: MINISERVE_TITLE=]\n\n      --header \u003cHEADER\u003e\n          Inserts custom headers into the responses. Specify each header as a 'Header:Value' pair. This\n          parameter can be used multiple times to add multiple headers.\n\n          Example: --header \"Header1:Value1\" --header \"Header2:Value2\" (If a header is already set or\n          previously inserted, it will not be overwritten.)\n\n          [env: MINISERVE_HEADER=]\n\n  -l, --show-symlink-info\n          Visualize symlinks in directory listing\n\n          [env: MINISERVE_SHOW_SYMLINK_INFO=]\n\n  -F, --hide-version-footer\n          Hide version footer\n\n          [env: MINISERVE_HIDE_VERSION_FOOTER=]\n\n      --hide-theme-selector\n          Hide theme selector\n\n          [env: MINISERVE_HIDE_THEME_SELECTOR=]\n\n  -W, --show-wget-footer\n          If enabled, display a wget command to recursively download the current directory\n\n          [env: MINISERVE_SHOW_WGET_FOOTER=]\n\n      --print-completions \u003cshell\u003e\n          Generate completion file for a shell\n\n          [possible values: bash, elvish, fish, powershell, zsh]\n\n      --print-manpage\n          Generate man page\n\n      --tls-cert \u003cTLS_CERT\u003e\n          TLS certificate to use\n\n          [env: MINISERVE_TLS_CERT=]\n\n      --tls-key \u003cTLS_KEY\u003e\n          TLS private key to use\n\n          [env: MINISERVE_TLS_KEY=]\n\n      --readme\n          Enable README.md rendering in directories\n\n          [env: MINISERVE_README=]\n\n  -I, --disable-indexing\n          Disable indexing\n\n          This will prevent directory listings from being generated and return an error instead.\n\n          [env: MINISERVE_DISABLE_INDEXING=]\n\n      --enable-webdav\n          Enable read-only WebDAV support (PROPFIND requests)\n\n          Currently incompatible with -P|--no-symlinks (see\n          https://github.com/messense/dav-server-rs/issues/37)\n\n          [env: MINISERVE_ENABLE_WEBDAV=]\n\n  -h, --help\n          Print help (see a summary with '-h')\n\n  -V, --version\n          Print version\n```\n\n## How to install\n\n\u003ca href=\"https://repology.org/project/miniserve/versions\"\u003e\u003cimg align=\"right\" src=\"https://repology.org/badge/vertical-allrepos/miniserve.svg\" alt=\"Packaging status\"\u003e\u003c/a\u003e\n\n**On Linux**: Download `miniserve-linux` from [the releases page](https://github.com/svenstaro/miniserve/releases) and run\n\n    chmod +x miniserve-linux\n    ./miniserve-linux\n\nAlternatively, if you are on **Arch Linux**, you can do\n\n    pacman -S miniserve\n\nOn [Termux](https://termux.com/)\n\n    pkg install miniserve\n\n**On OSX**: Download `miniserve-osx` from [the releases page](https://github.com/svenstaro/miniserve/releases) and run\n\n    chmod +x miniserve-osx\n    ./miniserve-osx\n\nAlternatively install with [Homebrew](https://brew.sh/):\n\n    brew install miniserve\n    miniserve\n\n**On Windows**: Download `miniserve-win.exe` from [the releases page](https://github.com/svenstaro/miniserve/releases) and run\n\n    miniserve-win.exe\n\nAlternatively install with [Scoop](https://scoop.sh/):\n\n    scoop install miniserve\n\n**With Cargo**: Make sure you have a recent version of Rust. Then you can run\n\n    cargo install --locked miniserve\n    miniserve\n\n**With Docker:** Make sure the Docker daemon is running and then run\n\n    docker run -v /tmp:/tmp -p 8080:8080 --rm -it docker.io/svenstaro/miniserve /tmp\n\n**With Podman:** Just run\n\n    podman run -v /tmp:/tmp -p 8080:8080 --rm -it docker.io/svenstaro/miniserve /tmp\n\n**With Helm:** See [this third-party Helm chart](https://codeberg.org/wrenix/helm-charts/src/branch/main/miniserve) by @wrenix.\n\n## Shell completions\n\nIf you'd like to make use of the built-in shell completion support, you need to run `miniserve\n--print-completions \u003cyour-shell\u003e` and put the completions in the correct place for your shell. A\nfew examples with common paths are provided below:\n\n    # For bash\n    miniserve --print-completions bash \u003e ~/.local/share/bash-completion/completions/miniserve\n    # For zsh\n    miniserve --print-completions zsh \u003e /usr/local/share/zsh/site-functions/_miniserve\n    # For fish\n    miniserve --print-completions fish \u003e ~/.config/fish/completions/miniserve.fish\n\n## systemd\n\nA hardened systemd-compatible unit file can be found in `packaging/miniserve@.service`. You could\ninstall this to `/etc/systemd/system/miniserve@.service` and start and enable `miniserve` as a\ndaemon on a specific serve path `/my/serve/path` like this:\n\n    systemctl enable --now miniserve@-my-serve-path\n\nKeep in mind that you'll have to use `systemd-escape` to properly escape a path for this usage.\n\nIn case you want to customize the particular flags that miniserve launches with, you can use\n\n    systemctl edit miniserve@-my-serve-path\n\nand set the `[Service]` part in the resulting `override.conf` file. For instance:\n\n    [Service]\n    ExecStart=\n    ExecStart=/usr/bin/miniserve --enable-tar --enable-zip --no-symlinks --verbose -i ::1 -p 1234 --title hello --color-scheme monokai --color-scheme-dark monokai -- %I\n\nMake sure to leave the `%I` at the very end in place or the wrong path might be served.\nAlternatively, you can configure the service via environment variables:\n\n    [Service]\n    Environment=MINISERVE_ENABLE_TAR=true\n    Environment=MINISERVE_ENABLE_ZIP=true\n    Environment=\"MINISERVE_TITLE=hello world\"\n    ...\n\nYou might additionally have to override `IPAddressAllow` and `IPAddressDeny` if you plan on making\nminiserve directly available on a public interface.\n\n## Binding behavior\n\nFor convenience reasons, miniserve will try to bind on all interfaces by default (if no `-i` is provided).\nIt will also do that if explicitly provided with `-i 0.0.0.0` or `-i ::`.\nIn all of the aforementioned cases, it will bind on both IPv4 and IPv6.\nIf provided with an explicit non-default interface, it will ONLY bind to that interface.\nYou can provide `-i` multiple times to bind to multiple interfaces at the same time.\n\n## Why use this over alternatives?\n\n- darkhttpd: Not easily available on Windows and it's not as easy as download-and-go.\n- Python built-in webserver: Need to have Python installed, it's low performance, and also doesn't do correct MIME type handling in some cases.\n- netcat: Not as convenient to use and sending directories is [somewhat involved](https://nakkaya.com/2009/04/15/using-netcat-for-file-transfers/).\n\n## Releasing\n\nThis is mostly a note for me on how to release this thing:\n\n- Make sure `CHANGELOG.md` is up to date.\n- `cargo release \u003cversion\u003e`\n- `cargo release --execute \u003cversion\u003e`\n- Releases will automatically be deployed by GitHub Actions.\n- Update Arch package.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvenstaro%2Fminiserve","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsvenstaro%2Fminiserve","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvenstaro%2Fminiserve/lists"}