mike chambers | about

Simple HTTP Server for local testing

I am currently playing around with the HTML5 FileSystem API, and have a need to test my files served via a web server. I could setup a virtual director for my local apache server, but given the number of simple tests and experiments I do, I wanted something easier that required little to no configuration and setup.

So, I put together a super simple script that uses python’s SimpleHTTPServer class.

Here is the script (requires that python is installed and in your path)


python -m SimpleHTTPServer $1

To use it, just switch the the directory that contains your files and run:


This will open a simple webserver on port 8000.

You can optionally pass in the port like so:

http 2030

Which will start a simple web server listening on port 2030.

Again, this is something really simple, but also very useful. If you need to quickly test a file, just switch to the directory and run the script.

Btw, another work around for playing with the FileSystem APIs would be to pass the:


to Chrome when launching it.

Update 2/1/2016 : For python 3, the command is:

python -m http.server PORT

and thus the bash script would be:


python -m http.server $1

If I get some time, Ill update the script to just automatically detect the version of python running.

twitter github flickr behance