Cro::FCGI
NAME
Cro::FCGI
FastCGI support for Cro
Synopsis
Using a network connection
use Cro::FCGI::Server;
my $service = Cro::FCGI::Server.new(
host => '127.0.0.1',
port => 43210,
application => MyCroApp
);
$service.start;
Webserver config (Apache here):
Listen 43210
<VirtualHost 127.0.0.1:43210>
ProxyFCGIBackendType GENERIC
ProxyPass "/" "fcgi://127.0.0.1:43211/" enablereuse=on
</VirtualHost>
Using a Unix socket
use Cro::FCGI::Server;
my $service = Cro::FCGI::Server.new(
socket-path => '/run/cro-fcgi/my-cro-app.sock',
application => MyCroApp
);
$service.start;
Webserver config (Apache here):
Listen 43210
<VirtualHost 127.0.0.1:43210>
ProxyFCGIBackendType GENERIC
ProxyPass "/" "unix:/run/cro-fcgi/my-cro-app.sock|fcgi://127.0.0.1/" enablereuse=on
</VirtualHost>
Description
This module provides a FastCGI frontend for Cro. It allows a simple coupling of a webserver and Cro application.
The module provides a drop-in replacement for Cro::HTTP::Server
named Cro::FCGI::Server
. It can be instantiated for either a network connetion or a Unix socket connection.
To start listening on a network port pass the host
and port
arguments.
To start listening on a Unix socket, pass the socket-path
argument. Make sure the socket is readable and writable by the webserver process. Note that SELinux can possibly block access to the socket file for the webserver.
Server and client host and port
To access the remote and local host and port of the connection of a given request, use the .socket-host
, .socket-port
, .peer-host
and .peer-port
methods of the request object, not the equally named methods of the Cro::Connection
object ($request.connection.*
). With FCGI, the connection represents the connection to the webserver, not the client!
Limitations
Currently starting the application process automatically is not supported. You have to start the Cro application separately. For Apache this means you should use mod_proxy_fcgi
instead of mod_fcgid
.
AUTHOR
Patrick Böker [email protected]
License
This module is distributed under the terms of the Artistic License 2.0.