環境
AWS t2-micro
ap-southeast-1a
unit 0.1-1.el7.ngx
CentOS 7 (x86_64) - with Updates HVM
注意
(Precompiled binaries for Unit are available for CentOS 7.0 and Ubuntu 16.04 LTS.)
php5.4 (default)
※セキュリティグループの設定等割愛
Nginx Unitインストール
1.リポジトリの設定
/etc/yum.repos.d/unit.repo を作成
[unit]
name=unit repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=0
enabled=1
2.インストール
yum install unit
3.nginx unit のコンフィグの作成
{
"applications": {
"php": {
"type": "php",
"user": "nobody",
"workers": 2,
"root": "/path/to", #任意のパス設定
"index": "index.php"
},
},
"listeners": {
"*:80": {
"application": "php"
}
}
}
PHP設定
phpの設置(実行権限はつける。実行権限がないと500Error)
任意のパスにindex.phpファイルの作成(とりあえずinfo出すだけの処理)
<?php
phpinfo();
?>
実行
service unitd start
service unitd restoreconfig /path/to/configファイル
以上でブラウザからアクセス可能