HTTP Server to serve Current Directory

by mmahmoodict on 15 Mar 2013 14:20

Suppose, one of your colleague want to see your movie collection on your pc, but you don't want to share the directory. So, the simple solution is - run a http server which serve current directory.

It's simple on linux, since python is install by default!

python -m SimpleHTTPServer <port[optional]>

It runs on port 8000 by default, but you can still change it.

So, just give to your colleague.

http://<YourIP>:8000/

It would serve until you close the terminal window.

If you just need to serve a html file, than - just use nc command on linux!

while true ; do nc -l 9000 < /tmp/index.html ; done
http://<YourIP>:9000/
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License