Commit | Line | Data |
c34dd09b |
1 | =head2 Development server deployment |
2 | |
3 | The development server is a mini web server written in perl. If you |
4 | expect a low number of hits or you don't need mod_perl/FastCGI speed, |
5 | you could use the development server as the application server with a |
6 | lightweight proxy web server at the front. However, consider using |
7 | L<Catalyst::Engine::HTTP::Prefork> for this kind of deployment instead, since |
8 | it can better handle multiple concurrent requests without forking, or can |
9 | prefork a set number of servers for improved performance. |
10 | |
11 | =head3 Pros |
12 | |
13 | As this is an application server setup, the pros are the same as |
14 | FastCGI (with the exception of speed). |
15 | It is also: |
16 | |
17 | =head4 Simple |
18 | |
19 | The development server is what you create your code on, so if it works |
20 | here, it should work in production! |
21 | |
22 | =head3 Cons |
23 | |
24 | =head4 Speed |
25 | |
26 | Not as fast as mod_perl or FastCGI. Needs to fork for each request |
27 | that comes in - make sure static files are served by the web server to |
28 | save forking. |
29 | |
30 | =head3 Setup |
31 | |
32 | =head4 Start up the development server |
33 | |
34 | script/myapp_server.pl -p 8080 -k -f -pidfile=/tmp/myapp.pid |
35 | |
36 | You will probably want to write an init script to handle stop/starting |
37 | the app using the pid file. |
38 | |
39 | =head4 Configuring Apache |
40 | |
41 | Make sure mod_proxy is enabled and add: |
42 | |
43 | # Serve static content directly |
44 | DocumentRoot /var/www/MyApp/root |
45 | Alias /static /var/www/MyApp/root/static |
46 | |
47 | ProxyRequests Off |
48 | <Proxy *> |
49 | Order deny,allow |
50 | Allow from all |
51 | </Proxy> |
52 | |
53 | # Need to specifically stop these paths from being passed to proxy |
54 | ProxyPass /static ! |
55 | ProxyPass /favicon.ico ! |
56 | |
57 | ProxyPass / http://localhost:8080/ |
58 | ProxyPassReverse / http://localhost:8080/ |
59 | |
60 | # This is optional if you'd like to show a custom error page |
61 | # if the proxy is not available |
62 | ErrorDocument 502 /static/error_pages/http502.html |
63 | |
64 | You can wrap the above within a VirtualHost container if you want |
65 | different apps served on the same host. |
66 | |
67 | =head1 AUTHORS |
68 | |
69 | Catalyst Contributors, see Catalyst.pm |
70 | |
71 | =head1 COPYRIGHT |
72 | |
73 | This library is free software. You can redistribute it and/or modify it under |
74 | the same terms as Perl itself. |
75 | |
76 | =cut |