NGINX Unit が正式リリースされたので ドキュメント を読みながら PHP を動作させるまでのメモ。環境は CentOS 7。
まずは /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 unit-php を実行してインストール。
確認用PHPファイル /home/mgng/www_unit/index.php を以下内容で作成。
<?php phpinfo();
設定ファイル /etc/unit/unit.conf を以下の内容で作成。
{
"listeners": {
"*:8300": {
"application": "unittest"
}
},
"applications": {
"unittest": {
"type": "php",
"processes": 20,
"user": "mgng",
"group": "mgng",
"root": "/home/mgng/www_unit",
"index": "index.php"
}
}
}
以下コマンドで起動。CentOS 7 なので systemctl を使うべきだろうけれど、loadconfig の指定ってどうやるんだろう。
service unit start service unit loadconfig /etc/unit/unit.conf
http://localhost:8300/ アクセスで phpinfo が表示されればOK。現時点ではPHP5.4。現時点で PHP 7 を使うにはソースからビルドするしかなさそう。

≪ 2018-04-20
MySQL の FULLTEXT インデックスを使ってブログの全文検索を作った
2018-04-16 ≫
人生初フルマラソン