Serving static files locally

Need to quickly share files over your local network? Here are several simple ways to create a static file server.

Quick Start Commands

ℹ️
All these servers will serve files from your current directory. Make sure you’re in the right folder before starting the server These servers are for development and local use only. Don’t use them in production environments.
# Starts server on port 8000
python -m http.server 8000

# Access via: http://localhost:8000

Features:

  • Zero installation (Python 3 included in most systems)
  • Directory listing
# Starts server on port 8000
python -m SimpleHTTPServer 8000

# Access via: http://localhost:8000

Note: Only use if Python 3 isn’t available

First, install using npm:

npm install --global serve

Then run:

serve  # Default port 3000
# OR
serve --port 8000  # Custom port