just for learning unit how to use
nano /etc/yum.repos.d/unit.repo
[unit]
name=unit repo
baseurl=https://packages.nginx.org/unit/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
yum install unit
yum install unit-php unit-python unit-go unit-perl
- start unit server
systemctl restart unit
- application registe
curl -X PUT -d @$PWD/unit/blog.json \
--unix-socket /var/run/control.unit.sock http://localhost/
- application describe json file
{
"listeners": {
"*:8300": {
"application": "blogs"
}
},
"applications": {
"blogs": {
"type": "php",
"processes": 20,
"root": "/opt/blogs/scripts", # where to run
"index": "index.php" # index page
}
}
}
- access
just like below
curl -i http://localhost:8300
HTTP/1.1 200 OK
X-Powered-By: PHP/5.4.16
Content-type: text/html
Server: Unit/0.7
Date: Sat, 07 Apr 2018 05:00:18 GMT
Transfer-Encoding: chunked
dalong demo unit