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/
In reply to Re^2: NGINX Unit + PSGI + Perl
by tbusch
in thread NGINX Unit + PSGI + Perl
by tbusch
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |