> ## Content Index
> Fetch the complete content index at: https://mfitzp.ghost.io/llms.txt
> Use this file to discover other available public pages before exploring further.

# Quickly serve a folder via Web Server
- URL: https://mfitzp.ghost.io/quickly-serve-a-folder-via-web-server/
- Published: 2011-11-08T00:00:00.000Z
- Updated: 2026-09-09T09:28:13.000Z
- Author: Martin Fitzpatrick
- Tags: Tutorials, #Import 2024-03-14 08:20, #Import 2026-08-24 14:26

Sometimes you'll want to quickly serve a folder from the command line, so you can view the contents in the browser. For example, if you're generating a static website or want to view how animated GIFs or SVGs appear in the browser. 

Python comes with a mini web server included, which you can use to serve any folder. In this short tutorial we'll step through the process for serving a folder, as well as customizing the port on which the files are served.

## Start the server

`cd` to the directory you want to serve.

At the shell prompt enter `python -m http.server`

## 

## Access the files from your browser

When run the command will output the address & port that the server is available on.

```bash
www $ python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
```

💡

The address 0.0.0.0 or 127.0.0.1 both refer to your local machine, which are accessible in your browser using the hostname `localhost`.

Open your web browser and access `http://localhost:PORT/`

You can optionally provide a port number e.g. `python -m http.server 8080` to set the port yourself. You can only serve a single folder at each port. If you set the port number yourself remember to change the port used in when accessing in the browser. 

For example, using `python -m http.server 8080` we would access the served folder through with `http://localhost:8080`