2

I have a FastCGI Perl web app (written using CGI::Fast, but that should not matter), that I'd like to test in FastCGI mode.

What Perl module can I use to run FastCGI application (the module should install from CPAN, best if it didn't use extra libraries), so that can I point web browser e.g. to http://localhost:5000 to check if it work correctly?

Better, is there some Test::* module which allow to automatically test FastCGI applications, as FastCGI applications?


Added 06-07-2010:
It looks like there is no standalone FastCGI server in Perl; or at least I didn't found one. The FCGI / FastCGI related modules on CPAN that I have found are about writing FastCGI application, or connecting to existing FastCGI server.

1
  • I'm working on a FastCGI implementation in C. It's designed as an interruptible parser (implemented using an FSM) for use with asynchronous server models, so it does not perform any I/O by itself . It can be easily integrated into any server or program model. It provides for need on both sides of the wire. Feel free to check it out. Commented Oct 30, 2011 at 22:44

1 Answer 1

3

I don't know of a module that allows you to test Fast CGI applications specifically. To run a Fast CGI script for testing while developing I usually set up a small lighttpd server like this:

$HTTP["url"] =~ "^/[^/]*$" {
    fastcgi.server = (
        "/" => ((
            "socket" => "/tmp/myapp.sock",
            "bin-path" => "/path/to/my/fastcgi/script.pl",
            "check-local" => "disable",
            "allow-x-send-file" => "enable",
        )),
    )
}

# Use this if you also want to serve static files directly (not through your CGI app).
$HTTP["url"] =~ "^/static/.*$" {
    url.rewrite-once = ( "^/static/\(.*\)$" => "static/$1" )
}

You might also want to set the port to 5000 or anything higher than 1024 so you can run it as user. Save the file in your projects directory and run lighttpd like this:

/usr/sbin/lighttpd -f lighttpd.conf -D
Sign up to request clarification or add additional context in comments.

2 Comments

start lighttpd like this lighttpd -f config.cnf -D I needed to add these lines to above for a full standalone lighttpd conf : server.document-root = "/var/www/" server.port = 8082 server.errorlog = "error.log" static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ) server.modules += ( "mod_fastcgi" )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.