一昨日あたりからnginxを始めました。
インストール
yum -y install nginx yum -y install php-fpm yum -y install php-mysql php-mbstring php-mcrypt
ドキュメントルートディレクトリを用意する
mkdir -p /var/www/html
/etc/nginx/nginx.conf
location / { root /var/www/html; index index.php index.html index.htm; } location ~ \.php$ { fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name; include fastcgi_params; }
/etc/php-fpm.d/www.conf
listen = 127.0.0.1:9000 ↓ listen = /var/run/php-fpm/php-fpm.sock ;listen.owner = nobody ;listen.group = nobody ;listen.mode = 0666 ↓ listen.owner = nginx listen.group = nginx listen.mode = 0664 ; RPM: apache Choosed to be able to access some dir as httpd user = apache ; RPM: Keep a group allowed to write in log dir. group = apache ↓ ; RPM: apache Choosed to be able to access some dir as httpd user = nginx ; RPM: Keep a group allowed to write in log dir. group = nginx
起動
service php-fpm start service nginx start chkconfig php-fpm on chkconfig nginx on
動作確認
cat <<EOF >/var/www/html/index.php <?php phpinfo(); EOF
蛇足
[root@ip-xxx-xxx-xxx-xxx html]# cat /etc/system-release Amazon Linux AMI release 2013.09