How to Install and Use miniserve in Linux to Serve Files and Directories Over HTTP

Sharing files between computers on a local network often feels unnecessarily cumbersome. Traditional methods—such as copying to USB thumb drives, configuring complex Samba or NFS shares, or spinning up heavyweight web servers like Nginx or Apache—require extensive configuration. While Python’s http.server module provides a quick one-line HTTP server, it lacks upload capabilities, authentication, visual appeal, and modern transfer speeds. miniserve is an open-source command-line tool written in Rust that instantly serves files, directories, or upload portals over HTTP with a single terminal command.

What Is miniserve in Linux?

Developed with speed and simplicity in mind, miniserve converts any local Linux directory into a fully functional web server accessible to any device with a standard web browser on your network. It features an attractive responsive web interface, supports simultaneous file uploads, displays QR codes for instant mobile smartphone pairing, and enforces password authentication whenever security is required.

Because it is compiled into a single self-contained native binary, miniserve requires zero external dependencies, runtimes, or database engines to operate.

How to Install miniserve on Linux

You can install miniserve using precompiled binaries, package managers, or Cargo.

Method 1: Installing via Precompiled Binary (Recommended)

Download the latest prebuilt binary directly from GitHub releases:

curl -fsSL https://github.com/svenstaro/miniserve/releases/latest/download/miniserve-linux-x86_64 -o miniserve
chmod +x miniserve
sudo mv miniserve /usr/local/bin/

Method 2: Installing via Cargo (Rust Package Manager)

If you have the Rust toolchain installed:

cargo install miniserve

Method 3: Installing via Snap

On distributions supporting Snap packages:

sudo snap install miniserve

Confirm the installation was successful by checking the version:

miniserve --version

Serving a Directory Instantly

To serve the contents of your current working directory across your local network:

miniserve .

By default, miniserve binds to port 8080 across all network interfaces. The terminal output displays local IP addresses along with a generated ASCII QR code. You can scan the QR code with an iPhone or Android camera to instantly open the file directory in your mobile browser without manually typing IP addresses.

To serve a specific directory instead of the current path:

miniserve /var/log/nginx

To specify a custom network port:

miniserve -p 9000 ~/Documents

Enabling File Uploads Through the Web Interface

One of miniserve‘s strongest advantages over standard HTTP file servers is its built-in upload engine. To enable an upload portal where colleagues or mobile devices can push files back to your Linux machine:

miniserve -u ~/Shared_Folder

When visitors open the web interface, a prominent drag-and-drop file upload zone appears at the top of the browser view. Users can upload individual files, multiple assets, or entire directory trees simultaneously.

To prevent users from overwriting existing files during uploads, append the upload restriction flag:

miniserve -u --no-overwrite ~/Shared_Folder

Securing Your Server with HTTP Authentication

If you are operating on a public coffee shop Wi-Fi network or shared office LAN, protect sensitive directories with username and password authentication:

miniserve --auth admin:SecretPass123 ~/Backups

Anyone attempting to navigate to the web page will be met with a standard HTTP Basic Authentication prompt before any directory listings are displayed.

Serving Single Files and Tar Archives on the Fly

You can serve single isolated files rather than exposing entire folder structures:

miniserve debian-12-server.iso

Furthermore, miniserve allows visitors to download entire subfolders as compressed archives without pre-packaging them manually:

miniserve --enable-tar --enable-zip ~/Projects

Visitors can click a download button next to any folder to stream a live-generated .tar.gz or .zip archive directly through their browser.

Advanced Usage: Enabling TLS/HTTPS Encryption

To serve files over encrypted HTTPS connections using local SSL/TLS certificates:

miniserve --tls-cert cert.pem --tls-key key.pem ~/Confidential

This prevents eavesdropping across untrusted local networks and enables browser features that mandate secure HTTPS contexts.

Frequently Asked Questions

How do I stop the miniserve server?

Press Ctrl + C in your active terminal window to gracefully terminate the server and release the network port.

Can miniserve run in the background as a systemd service?

Yes. You can write a standard systemd unit file pointing ExecStart to /usr/local/bin/miniserve to maintain a persistent local network file sharing service across server reboots.

Does miniserve expose files to the public internet?

By default, miniserve listens on your local area network (LAN). It is only accessible from the public internet if your router forwards the configured port to your machine or if you run it on a public VPS cloud server.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.