X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FDeployment%2FApache%2FFastCGI.pod;h=63df78cadef4d953455c5cb10e122615ec554520;hb=0191b4351578d840cba62c5eb24a7f51238f6076;hp=a53af03bf9bdbc7df0307aac3114002f699f51fb;hpb=1d2376f30da280120d06a3579eef74d9b0770f20;p=catagits%2FCatalyst-Manual.git diff --git a/lib/Catalyst/Manual/Deployment/Apache/FastCGI.pod b/lib/Catalyst/Manual/Deployment/Apache/FastCGI.pod index a53af03..63df78c 100644 --- a/lib/Catalyst/Manual/Deployment/Apache/FastCGI.pod +++ b/lib/Catalyst/Manual/Deployment/Apache/FastCGI.pod @@ -14,6 +14,105 @@ the L module from cpan. Important Note! If you experience difficulty properly rendering pages, try disabling Apache's mod_deflate (Deflate Module), e.g. 'a2dismod deflate'. +=head2 Apache 1.x, 2.x + +Apache requires the mod_fastcgi module. The same module supports both +Apache 1 and 2. + +There are three ways to run your application under FastCGI on Apache: server, +static, and dynamic. + +=head3 Standalone server mode + + FastCgiExternalServer /tmp/myapp.fcgi -socket /tmp/myapp.socket + Alias /myapp/ /tmp/myapp.fcgi/ + + # Or, run at the root + Alias / /tmp/myapp.fcgi/ + + # Optionally, rewrite the path when accessed without a trailing slash + RewriteRule ^/myapp$ myapp/ [R] + + +The FastCgiExternalServer directive tells Apache that when serving +/tmp/myapp to use the FastCGI application listenting on the socket +/tmp/mapp.socket. Note that /tmp/myapp.fcgi B exist -- +it's a virtual file name. With some versions of C or +C, you can use any name you like, but some require that the +virtual filename end in C<.fcgi>. + +It's likely that Apache is not configured to serve files in /tmp, so the +Alias directive maps the url path /myapp/ to the (virtual) file that runs the +FastCGI application. The trailing slashes are important as their use will +correctly set the PATH_INFO environment variable used by Catalyst to +determine the request path. If you would like to be able to access your app +without a trailing slash (http://server/myapp), you can use the above +RewriteRule directive. + +=head3 Static mode + +The term 'static' is misleading, but in static mode Apache uses its own +FastCGI Process Manager to start the application processes. This happens at +Apache startup time. In this case you do not run your application's +fastcgi.pl script -- that is done by Apache. Apache then maps URIs to the +FastCGI script to run your application. + + FastCgiServer /path/to/myapp/script/myapp_fastcgi.pl -processes 3 + Alias /myapp/ /path/to/myapp/script/myapp_fastcgi.pl/ + +FastCgiServer tells Apache to start three processes of your application at +startup. The Alias command maps a path to the FastCGI application. Again, +the trailing slashes are important. + +=head3 Dynamic mode + +In FastCGI dynamic mode, Apache will run your application on demand, +typically by requesting a file with a specific extension (e.g. .fcgi). ISPs +often use this type of setup to provide FastCGI support to many customers. + +In this mode it is often enough to place or link your *_fastcgi.pl script in +your cgi-bin directory with the extension of .fcgi. In dynamic mode Apache +must be able to run your application as a CGI script so ExecCGI must be +enabled for the directory. + + AddHandler fastcgi-script .fcgi + +The above tells Apache to run any .fcgi file as a FastCGI application. + +Here is a complete example: + + + ServerName www.myapp.com + DocumentRoot /path/to/MyApp + + # Allow CGI script to run + + Options +ExecCGI + + + # Tell Apache this is a FastCGI application + + SetHandler fastcgi-script + + + +Then a request for /script/myapp_fastcgi.pl will run the +application. + +For more information on using FastCGI under Apache, visit +L + +=head3 Authorization header with mod_fastcgi or mod_cgi + +By default, mod_fastcgi/mod_cgi do not pass along the Authorization header, +so modules like C will +not work. To enable pass-through of this header, add the following +mod_rewrite directives: + + RewriteCond %{HTTP:Authorization} ^(.+) + RewriteRule ^(.*)$ $1 [E=HTTP_AUTHORIZATION:%1,PT] + + =head4 2. Configure your application # Serve static content directly @@ -62,7 +161,7 @@ Now, we simply configure Apache to connect to the running server. =head3 More Info -L - XXX FIXME. +L. =head1 AUTHORS