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

Posted in: Technical Track

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/app.pl -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/app.pl -p 8086
email
Want to talk with an expert? Schedule a call with our team to get the conversation started.

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *