How To: Create A Simple HTTP Server In Linux

To set up a temporary, very simple, HTTP server for any directory in your /home directory, follow these instructions.

Open a terminal and cd to the directory of choice.

Issue the following command:

You can then access the contents of that directory using a browser pointed at the IP address of the PC at port 8000.  as an example, from any PC on the LAN.

You can also access the directory from the same machine (not very useful) using


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, then the command would be:

python -m SimpleHTTPServer 8888  (or whatever port you chose for example 8080)

I find this really simple and useful at times. Keep it in mind; you might find it equally convenient.

Photo by paulward8

You might also like