Last Updated: February 27, 2018
·
2.292K
· marcelor

Simple HTTP server

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:

http://127.0.0.1:8000

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.

If you wish to change the port that's used start the program via:

$ python -m SimpleHTTPServer 8080

source: http://www.linuxjournal.com/content/tech-tip-really-simple-http-server-python