| 1 |
=head1 NAME |
| 2 |
|
| 3 |
Catalyst::Manual::Deployment::NGINXUnit::PSGI - Deploying Catalyst with NGINX Unit |
| 4 |
|
| 5 |
=head1 NGINX Unit |
| 6 |
|
| 7 |
Catalyst runs under L<NGINX Unit|https://unit.nginx.org> using PSGI. |
| 8 |
|
| 9 |
=head2 Configuration |
| 10 |
|
| 11 |
To configure a Catalyst app in NGINX Unit, upload a JSON configuration |
| 12 |
snippet via Unit's config API, available at an IP socket or a Unix domain |
| 13 |
socket (depending on Unit's L<startup settings| |
| 14 |
https://unit.nginx.org/installation/#installation-startup>): |
| 15 |
|
| 16 |
# curl -X PUT --data-binary @config.json --unix-socket \ |
| 17 |
/path/to/control.unit.sock http://localhost/config |
| 18 |
|
| 19 |
A minimal L<configuration|https://unit.nginx.org/configuration/#perl> |
| 20 |
includes a listener and an application entity: |
| 21 |
|
| 22 |
{ |
| 23 |
"listeners": { |
| 24 |
"127.0.0.1:8080": { |
| 25 |
"pass": "applications/catalyst_app" |
| 26 |
} |
| 27 |
}, |
| 28 |
|
| 29 |
"applications": { |
| 30 |
"catalyst_app": { |
| 31 |
"type": "perl", |
| 32 |
"script": "/path/to/apps/myapp/myapp.psgi", |
| 33 |
"user": "catalyst_user", |
| 34 |
"group": "catalyst_group" |
| 35 |
} |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
The C<script> should point to your app's C<.psgi> file; C<user> and |
| 40 |
C<group> should have appropriate access rights. |
| 41 |
|
| 42 |
After a successful reconfiguration, you can manage your Catalyst |
| 43 |
app via the same L<config API| |
| 44 |
https://unit.nginx.org/configuration/#applications>. |
| 45 |
|
| 46 |
=over |
| 47 |
|
| 48 |
Note: make sure the app's C<.psgi> file includes the C<lib/> |
| 49 |
directory: |
| 50 |
|
| 51 |
use lib 'lib'; |
| 52 |
use myapp; |
| 53 |
|
| 54 |
=back |
| 55 |
|
| 56 |
=head1 MORE INFO |
| 57 |
|
| 58 |
For more information on NGINX Unit, visit: L<http://unit.nginx.org> |
| 59 |
|
| 60 |
=head1 AUTHORS |
| 61 |
|
| 62 |
Catalyst Contributors, see Catalyst.pm |
| 63 |
|
| 64 |
=head1 COPYRIGHT |
| 65 |
|
| 66 |
This library is free software. You can redistribute it and/or modify it under |
| 67 |
the same terms as Perl itself. |
| 68 |
|
| 69 |
=cut |