The Guerilla Hack Chronicles: Dancer as an Ad-Hoc Web Server

Mar 14, 2011 / By Yanick Champoux

Tags: ,

Let’s say you want to serve static http content from a machine. The sensible thing to do would be to install Apache/Nginx/Lighttp.

But let’s say — because of insane configuration, red tape, cruel whims of the gods — that you can’t do the sensible thing.

Fortunately, there’s a few aces you can pull from out of your sleeve.

One of them is to use Dancer as a spur-of-the-moment barebone web server:

$ dancer -a proxy
$ cd proxy
$ rm -fr public/ && ln -s /path/to/share public
$ ./bin/ -p 8086

With that, we now have a single-threaded web server listening on port 8086 serving the files of /path/to/share.

If you need it to be more beefy, as in act like a real web server and deal with concurent requests, just plack it up:

$ plackup bin/ -p 8086

Share this article

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>