Unix HOWTOs and Tips Short unix command line administration tips and scripts

9Nov/110

How to conveniently serve a folder of files over http

It is very simple actually (although not as fast as using a dedicated web server like nginx). Just use python:

cd YourFolder
python -m SimpleHTTPServer

That's it ! After running this line, the files in your current folder will be accessible over port 8000, so you can send your pears a link like this: http://YourIPHere:8000/ , and they will be able to read the shared folder.

You can change the port very easily too - just append it at the end of the last command, like this :

python -m SimpleHTTPServer 11001

That will run a webserver for the current folder over port 11001, instead of the default port 8000.

Stopping the python webserver process is simple too - just type Ctrl-C, like you would do for any other long running shell process.

Posted by Delyan Angelov

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.