More cooked
[catagits/Catalyst-Manual.git] / lib / Catalyst / Manual / Deployment / Apache / FastCGI.pod
CommitLineData
1d2376f3 1=head1 NAME
2
3Catalyst::Manual::Deployment::Apache::FastCGI - Deploying Catalyst with FastCGI on Apache
4
5=head2 Setup
6
7=head3 1. Install Apache with mod_fastcgi
8
9mod_fastcgi for Apache is a third party module, and can be found at
10L<http://www.fastcgi.com/>. It is also packaged in many distributions,
11for example, libapache2-mod-fastcgi in Debian. You will also need to install
12the L<FCGI> module from cpan.
13
14Important Note! If you experience difficulty properly rendering pages,
15try disabling Apache's mod_deflate (Deflate Module), e.g. 'a2dismod deflate'.
16
17=head4 2. Configure your application
18
19 # Serve static content directly
20 DocumentRoot /var/www/MyApp/root
21 Alias /static /var/www/MyApp/root/static
22
23 FastCgiServer /var/www/MyApp/script/myapp_fastcgi.pl -processes 3
24 Alias /myapp/ /var/www/MyApp/script/myapp_fastcgi.pl/
25
26 # Or, run at the root
27 Alias / /var/www/MyApp/script/myapp_fastcgi.pl/
28
29The above commands will launch 3 app processes and make the app available at
30/myapp/
31
32=head3 Standalone server mode
33
34While not as easy as the previous method, running your app as an external
35server gives you much more flexibility.
36
37First, launch your app as a standalone server listening on a socket.
38
39 script/myapp_fastcgi.pl -l /tmp/myapp.socket -n 5 -p /tmp/myapp.pid -d
40
41You can also listen on a TCP port if your web server is not on the same
42machine.
43
44 script/myapp_fastcgi.pl -l :8080 -n 5 -p /tmp/myapp.pid -d
45
46You will probably want to write an init script to handle starting/stopping
47of the app using the pid file.
48
49Now, we simply configure Apache to connect to the running server.
50
51 # 502 is a Bad Gateway error, and will occur if the backend server is down
52 # This allows us to display a friendly static page that says "down for
53 # maintenance"
54 Alias /_errors /var/www/MyApp/root/error-pages
55 ErrorDocument 502 /_errors/502.html
56
57 FastCgiExternalServer /tmp/myapp.fcgi -socket /tmp/myapp.socket
58 Alias /myapp/ /tmp/myapp.fcgi/
59
60 # Or, run at the root
61 Alias / /tmp/myapp.fcgi/
62
63=head3 More Info
64
65L<Catalyst::Engine::FastCGI> - XXX FIXME.
66
67=head1 AUTHORS
68
69Catalyst Contributors, see Catalyst.pm
70
71=head1 COPYRIGHT
72
73This library is free software. You can redistribute it and/or modify it under
74the same terms as Perl itself.
75
76=cut
77