banner
Previous Page
PCLinuxOS Magazine
PCLinuxOS
Article List
Disclaimer
Next Page

Tip Top Tips: A Simple HTTP Server


Editor's Note: Tip Top Tips is a new monthly column in The PCLinuxOS Magazine. Each month, we will feature -- and possibly even expand upon -- one tip from the PCLinuxOS forum. The magazine will not accept independent tip submissions specifically intended for inclusion in the Tip Top Tips column. Rather, if you have a tip, share it in the PCLinuxOS forum's "Tips & Tricks" section. Your tip just may be selected for publication in The PCLinuxOS Magazine.

This month's tip comes from PCLinuxOS forum member Not_yet_16.


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:

python -m SimpleHTTPServer

You can then access the contents of that directory using a browser pointed at the IP address of the PC at port 8000.

192.168.3.12:8000 as an example, from any PC on the LAN.

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

http://127.0.0.1:8000

or

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

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

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



Previous Page              Top              Next Page