Deploying Dancer as FastCGI under debian/Apache2

Deplyoing Dancer under debian using apache2 is really easy:

You'll need:


  • libapache2-mod-fcgid

  • libplack-perl

  • libfcgi-perl

Then drop sth like this into your enabled apache2 site:

Alias / /usr/share/myapp/public/dispatch.fcgi/

And you're done! :)

1 Comment

I prefer libapache2-mod-fastcgi but YMMV.

Also, on shared hosts where one doesn't have access to server config and only to .htaccess (most Perl web frameworks ignore this use case, strangely), I usually put this in .htaccess:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ dispatch.fcgi$1 [QSA,L]

Also, for pure PSGI apps without any web frameworks, this is the dispatch.fcgi which I usually use:

#!/usr/bin/perl

use Plack::App::Apache::ActionWrapper;
my $app = Plack::App::Apache::ActionWrapper->new->to_app;

use Plack::Handler::FCGI;
Plack::Handler::FCGI->new->run($app);

Plack::App::Apache::ActionWrapper is available from CPAN.

Leave a comment

About corecatcher

user-pic I blog about Perl.