|
NAMEPlack::Handler::Apache2 - Apache 2.0 mod_perl handler to run PSGI applicationSYNOPSIS# in your httpd.conf <Location /> SetHandler perl-script PerlResponseHandler Plack::Handler::Apache2 PerlSetVar psgi_app /path/to/app.psgi </Location> # Optionally preload your apps in startup PerlPostConfigRequire /etc/httpd/startup.pl See "STARTUP FILE" for more details on writing a "startup.pl". DESCRIPTIONThis is a mod_perl handler module to run any PSGI application with mod_perl on Apache 2.x.If you want to run PSGI applications behind Apache instead of using mod_perl, see Plack::Handler::FCGI to run with FastCGI, or use standalone HTTP servers such as Starman or Starlet proxied with mod_proxy. CREATING CUSTOM HANDLERIf you want to create a custom handler that loads or creates PSGI applications using other means than loading from ".psgi" files, you can create your own handler class and use "call_app" class method to run your application.package My::ModPerl::Handler; use Plack::Handler::Apache2; sub get_app { # magic! } sub handler { my $r = shift; my $app = get_app(); Plack::Handler::Apache2->call_app($r, $app); } STARTUP FILEHere is an example "startup.pl" to preload PSGI applications:#!/usr/bin/env perl use strict; use warnings; use Apache2::ServerUtil (); BEGIN { return unless Apache2::ServerUtil::restart_count() > 1; require lib; lib->import('/path/to/my/perl/libs'); require Plack::Handler::Apache2; my @psgis = ('/path/to/app1.psgi', '/path/to/app2.psgi'); foreach my $psgi (@psgis) { Plack::Handler::Apache2->preload($psgi); } } 1; # file must return true! See <http://perl.apache.org/docs/2.0/user/handlers/server.html#Startup_File> for general information on the "startup.pl" file for preloading perl modules and your apps. Some things to keep in mind when writing this file:
AUTHORTatsuhiko MiyagawaCONTRIBUTORSPaul DriverÆvar Arnfjörð Bjarmason Rafael Kitover SEE ALSOPlack
Visit the GSP FreeBSD Man Page Interface. |