On Thu, 16 Jul 2015, Andrew Beverley wrote:

The easiest way to use Dancer with Apache is via FastCGI:

https://metacpan.org/pod/Dancer::Deployment#Running-as-a-cgi-script-or-fast-cgi

That link points to the RewriteEngine version.
I use:
  ScriptAlias /myapp /path/to/myapp/bin/dispatch.fcgi

Note:
- dispatch.fcgi is NOT in the document root
- Do NOT detach
-- in dispatch.fcgi
-- my $server = Plack::Handler::FCGI->new(nproc => 1, detach => 0);
- Running the same code as stand-alone for testing needs some tweeks

I have a scriptalias in my config.yml scriptalias: "/myapp"
and a plugin that exports the DSL keyword scriptalias
Loading sub-apps like this:

if (setting('environment') eq 'production') {
    load_app 'Subapp', prefix => '/subapp';
} else {
    load_app 'Subapp', prefix => scriptalias . '/subapp';
}

Mmm, maybe overkill...
setting some $scriptalias can construct a prefix "$scriptalias/subapp"

Running 'perl bin/app.pl' just works.

One can use this to slowly convert

  /cgi-bin/subapp1.pl
  /cgi-bin/subapp2.pl

to

  /myapp/subapp1
  /myapp/subapp2

HTH,
Henk
_______________________________________________
dancer-users mailing list
[email protected]
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users

Reply via email to