Open up a terminal and type:
$ cd /home/somedir
$ python -m SimpleHTTPServer
That’s it! Now your http server will start in port 8000. You will get the message:
Serving HTTP on 0.0.0.0 port 8000 …
Now open a browser and type the following address:
You can also access it via:
If the directory has a file named index.html, that file will be served as the initial file. If there is no index.html, then the files in the directory will be listed.
http://www.linuxjournal.com/content/tech-tip-really-simple-http-server-python
This has been super helpful for getting a server running locally for testing the browser’s built-in geolocation service.