[dancer-users] Multiple virtual hosts: one dancer instance or one per vhost?

Amelia Ireland aireland at lbl.gov
Wed Oct 7 17:00:07 BST 2015


On 7 October 2015 at 08:15, Tom Browder <tom.browder at gmail.com> wrote:
>
> On Wed, Oct 7, 2015 at 9:39 AM, WK <wanradt at gmail.com> wrote:
> ...
> > I think the most common setup for Dancer app is to run it with some
> > Plack-capable server (like Starman) behind some reverse proxy (like
> > nginx).
> ...
>
> Without a clear set of docs for deployment, I'm not sure I want to
> leap into that steep learning curve.

If you are already dealing with virtual hosts, adding a reverse proxy
should not be all that much more difficult. If you're running Apache, you
can use the ProxyPass directive to reverse proxy everything served on a
certain port, e.g.

    ProxyPass        / http://localhost:5001/
    ProxyPassReverse / http://localhost:5001/

and then run plackup to serve Dancer content on port 5001:

plackup -s Starman --workers=10 -p 5001 bin/app.psgi

If you want Apache to serve static content (images, js, css, etc.), you can
use Apache's rewrite directives:

RewriteEngine On
RewriteRule ^/static/(.*) /path/to/public/$1 [L]
ProxyPass / http://localhost:5001/
ProxyPassReverse / http://localhost:5001/

Anything under /static/ here gets served from the directory
/path/to/public/ by Apache, and all other requests get served by Dancer.

The server setup details for Dancer2 are very similar to those used by
Mojolicious, Catalyst, and other PSGI-capable frameworks, so you can check
their documentation for tips. I believe there was a Catalyst advent
calendar article with a full nginx server config in it, and the Mojolicious
wiki has some useful details too.

Good luck!
Amelia.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20151007/5add6319/attachment.html>


More information about the dancer-users mailing list