Deployment under CGI on Apache2 doesn't work #523

wolverian opened this Issue May 12, 2011 · 6 comments

5 participants


Given the script foo.cgi:

#!/usr/bin/env perl

use strict;
use warnings;

use Dancer;
use Data::Dumper 'Dumper';

set serializer => 'JSON';

post '/foo' => sub {


And this Apache 2 configuration in sites.enabled:

ScriptAlias /foo /path/to/foo.cgi

Opening results in this log entry in apache's error.log:

>> Dancer 1.3040 server 22693 listening on

I assumed Dancer would have detected it's running under CGI, based on the POD saying that CGI deployment "just works".

PerlDancer member

I'm pretty sure that you need to point ScriptAlias at a dispatch.cgi script like the one generated for you when you scaffold an app, which uses Plack::Runner to run the app as a CGI. Otherwise, your Dancer script will be executed and start a standalone server, as you're seeing.

I'll rework the Dancer::Deployment documentation on CGI usage soon to more clearly reflect that - thanks for pointing out that it's not all that clear!


Okay, thanks! I'll leave this open in case you want to track the doc issue here. Feel free to close.

@bigpresh bigpresh was assigned May 31, 2011

@bigpresh : can we close it ? or do you need to amend the documentation ?

PerlDancer member

Could do with updating the docs a bit; they've been improved, and mention using a dispatch.cgi, but I think they need to be more clear that it should be the script generated by the scaffolder, not the app itself.

They should also mention using ScriptAlias, I think.

I'll try to get a moment to deal with this soon.

PerlDancer member

@bigpresh update?

Can we help?


I'm sorry about the noobish-ness I'm a LAMP newbie.

This is only thing I have found with info on deploying to Apache with mod_perl.

Could someone list the steps or point to what needs to be done? I assumed that putting my dancer app in a virtual host folder setup to run with mod_perl would have just worked?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment