I'm trying to get Plack::App::CGIBin
to work using Apache2 and FastCGI on FreeBSD 8.2. The eventual aim is to be able to use this setup to serve a whole bunch of legacy CGI scripts via Plack, in order to take advantage of its middleware capabilities, but I haven't been able to get even a simple example working.
I've followed the CPAN documentation on Plack::Handler::FCGI and Plack::App::CGIBin itself, but I'm not sure if I'm missing something or doing something wrong which isn't covered by those docs.
This is the Apache config I've added:
# Set up external server
FastCgiExternalServer /tmp/placktest.fcgi -socket /tmp/fcgi.socket
# URL to be handled by FastCGI
Alias /plack/ /tmp/placktest.fcgi/
Command to run external server:
plackup -s FCGI --listen /tmp/fcgi.socket /data/www/psgi/app.psgi
The server starts successfully, returning the following:
FastCGI: manager (pid <pid>): initialized
FastCGI: manager (pid <pid>): server (pid <pid>) started
FastCGI: server (pid <pid>): initialized
This is app.psgi:
#!/usr/bin/env plackup -s FCGI
use Plack::App::CGIBin;
use Plack::Builder;
my $app = Plack::App::CGIBin->new(
root => '/data/www/plack',
)->to_app;
builder {
mount "/plack" => $app;
};
I then have a simple CGI script at /data/www/plack/test.cgi
(this file runs fine under CGI.pm).
What I'd expect is that a request to http://<domain>/plack/test.cgi/
(including the trailing slash) would return the test script, but I always get the following 404 error in the Apache error log, which I think is coming back from the FastCGI server:
FastCGI: server "/tmp/placktest.fcgi" stderr: <IP address/date>; "GET /plack/test.cgi HTTP/1.1" 404 9 "-" <User agent string>;
I've got FastCGI working on its own, using mod_fastcgi and a simple example script in a directory with SetHandler fastcgi-script
applied, so at least that worked :-).
Has anyone got Plack::App::CGIBin
working under a similar scenario? I'd greatly appreciate any insight!
Thanks
-host 127.0.0.1:5001
and in the plackup cmdline-listen 127.0.0.1:5001
. – Slaven Rezic/plack/placktest/
, and I don't see where else you use the string placktest other than in the thing you alias /plack/ to -- which makes me think it doesn't belong in the GET request. – James Green