Run Tiny Webserver From Any Directory

There are alternatives to Resolve Symlinks When Copying Files With Rsync .

How about firing up a (tiny) webserver that starts up quickly. Yehuda Katz suggested this some years ago:

Just drop this file in any directory, run the script, and it serves the files. I use this frequently for instance when I need to browser test static files on different virtual machines. (I modified the script shebang to work on my Mac).

I prefer to use this server.rb script in stead of accessing the files from a shared folder from the virtual machine. It’s faster to write the address for than for \\.host\Shared Folders\jesper On My Mac\src\htmlguide\accordion.html – and easier to remember.

Tip from Yehuda Katz’ “Webrick Anywhere

4 Responses to “Run Tiny Webserver From Any Directory”

  1. jj Says:

    Or you could run “python -m SimpleHTTPServer”

  2. Jesper Rønn-Jensen Says:

    @jj, thanks for the tip!

    I’m always flattered by comments like yours. The audience of this blog is just much smarter than I will ever get :)

  3. Eddy Tembilung Says:

    Thanks for your smartness, I will try to practice it.

  4. Nikolaj Nikolajsen » Blog Archive » Hurtig og nem fildeling Says:

    […] faldt over dette tip om at køre en lille webserver fra hvilket som helst bibliotek på din PC og det så umiddelbart interessant ud. En kommentar til artiklen var dog det der virkelig gjorde en […]