| 1 |
=head1 NAME |
| 2 |
|
| 3 |
Catalyst::Manual::DevelopmentServer - Development server deployment |
| 4 |
|
| 5 |
The development server is a mini web server written in Perl. However, if |
| 6 |
you supply the C<-f> option to the development server, it will load the |
| 7 |
higher performance L<Starman> server, which can be used as an |
| 8 |
application server with a lightweight proxy web server at the front. |
| 9 |
|
| 10 |
=head1 Setup |
| 11 |
|
| 12 |
=head2 Start up the development server |
| 13 |
|
| 14 |
script/myapp_server.pl -p 8080 -k -f --pidfile=/tmp/myapp.pid |
| 15 |
|
| 16 |
You will probably want to write an init script to handle stop/starting |
| 17 |
the app using the pid file. |
| 18 |
|
| 19 |
=head2 Configuring Apache |
| 20 |
|
| 21 |
Make sure mod_proxy is enabled and add: |
| 22 |
|
| 23 |
# Serve static content directly |
| 24 |
DocumentRoot /var/www/MyApp/root |
| 25 |
Alias /static /var/www/MyApp/root/static |
| 26 |
|
| 27 |
ProxyRequests Off |
| 28 |
<Proxy *> |
| 29 |
Order deny,allow |
| 30 |
Allow from all |
| 31 |
</Proxy> |
| 32 |
|
| 33 |
# Need to specifically stop these paths from being passed to proxy |
| 34 |
ProxyPass /static ! |
| 35 |
ProxyPass /favicon.ico ! |
| 36 |
|
| 37 |
ProxyPass / http://localhost:8080/ |
| 38 |
ProxyPassReverse / http://localhost:8080/ |
| 39 |
|
| 40 |
# This is optional if you'd like to show a custom error page |
| 41 |
# if the proxy is not available |
| 42 |
ErrorDocument 502 /static/error_pages/http502.html |
| 43 |
|
| 44 |
You can wrap the above within a VirtualHost container if you want |
| 45 |
different apps served on the same host. |
| 46 |
|
| 47 |
=head2 Other web servers |
| 48 |
|
| 49 |
The proxy configuration above can also be replicated with a different |
| 50 |
frontend server or proxy, such as varnish, nginx, or lighttpd. |
| 51 |
|
| 52 |
=head1 AUTHORS |
| 53 |
|
| 54 |
Catalyst Contributors, see Catalyst.pm |
| 55 |
|
| 56 |
=head1 COPYRIGHT |
| 57 |
|
| 58 |
This library is free software. You can redistribute it and/or modify it under |
| 59 |
the same terms as Perl itself. |
| 60 |
|
| 61 |
=cut |