in reply to Re: NGINX Unit + PSGI + Perl
in thread NGINX Unit + PSGI + Perl
Create /etc/yum.repos.d/unit.repo:sudo su -
Install unit and unit-perl[unit] name=unit repo baseurl=https://packages.nginx.org/unit/centos/$releasever/$basearch/ gpgcheck=0 enabled=1
In /etc/unit/ create two files:yum install -y unit unit-perl
app.psgi{ "type": "perl", "processes": 5, "script": "/etc/unit/app.psgi" }
Then start unit:use strict; use warnings; use Plack::Builder; my $app = sub { my $env = shift; [200, [], ["Hello world from PSGI!\n"]]; }; builder { enable 'ContentLength'; $app; };
Configure unit using the following commands:service unit start
.. and check the resulting config:curl -X PUT --data-binary @/etc/unit/start.json --unix-socket /var/run +/control.unit.sock http://localhost/config/applications/psgiapp curl -X PUT --data-binary '{"application":"psgiapp"}' --unix-socket /v +ar/run/control.unit.sock 'http://localhost/config/listeners/*:8000'
... and finally do the Hello World test:curl --unix-socket /var/run/control.unit.sock http://localhost/
Voila!curl -v http://127.0.0.1:8000/
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: NGINX Unit + PSGI + Perl
by tbusch (Sexton) on Feb 23, 2019 at 09:30 UTC |