3 Catalyst::Manual::Deployment::Apache::FastCGI - Deploying Catalyst with FastCGI on Apache
7 =head3 1. Install Apache with mod_fastcgi
9 mod_fastcgi for Apache is a third party module, and can be found at
10 L<http://www.fastcgi.com/>. It is also packaged in many distributions,
11 for example, libapache2-mod-fastcgi in Debian. You will also need to install
12 the L<FCGI> module from cpan.
14 Important Note! If you experience difficulty properly rendering pages,
15 try disabling Apache's mod_deflate (Deflate Module), e.g. 'a2dismod deflate'.
17 =head4 2. Configure your application
19 # Serve static content directly
20 DocumentRoot /var/www/MyApp/root
21 Alias /static /var/www/MyApp/root/static
23 FastCgiServer /var/www/MyApp/script/myapp_fastcgi.pl -processes 3
24 Alias /myapp/ /var/www/MyApp/script/myapp_fastcgi.pl/
27 Alias / /var/www/MyApp/script/myapp_fastcgi.pl/
29 The above commands will launch 3 app processes and make the app available at
32 =head3 Standalone server mode
34 While not as easy as the previous method, running your app as an external
35 server gives you much more flexibility.
37 First, launch your app as a standalone server listening on a socket.
39 script/myapp_fastcgi.pl -l /tmp/myapp.socket -n 5 -p /tmp/myapp.pid -d
41 You can also listen on a TCP port if your web server is not on the same
44 script/myapp_fastcgi.pl -l :8080 -n 5 -p /tmp/myapp.pid -d
46 You will probably want to write an init script to handle starting/stopping
47 of the app using the pid file.
49 Now, we simply configure Apache to connect to the running server.
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
54 Alias /_errors /var/www/MyApp/root/error-pages
55 ErrorDocument 502 /_errors/502.html
57 FastCgiExternalServer /tmp/myapp.fcgi -socket /tmp/myapp.socket
58 Alias /myapp/ /tmp/myapp.fcgi/
61 Alias / /tmp/myapp.fcgi/
65 L<Catalyst::Engine::FastCGI> - XXX FIXME.
69 Catalyst Contributors, see Catalyst.pm
73 This library is free software. You can redistribute it and/or modify it under
74 the same terms as Perl itself.