sudo su -
####
[unit]
name=unit repo
baseurl=https://packages.nginx.org/unit/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
####
yum install -y unit unit-perl
####
{
"type": "perl",
"processes": 5,
"script": "/etc/unit/app.psgi"
}
####
use strict;
use warnings;
use Plack::Builder;
my $app = sub {
my $env = shift;
[200, [], ["Hello world from PSGI!\n"]];
};
builder {
enable 'ContentLength';
$app;
};
####
service unit start
####
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 /var/run/control.unit.sock 'http://localhost/config/listeners/*:8000'
####
curl --unix-socket /var/run/control.unit.sock http://localhost/
####
curl -v http://127.0.0.1:8000/