EC2 + nginx + php-fpm

yumで何でもかんでも入れられて楽ちん

sudo yum install nginx
sudo yum install mysql-server
sudo yum install php php-fpm php-mbstring php-mysql

nginxの設定

sudo vi /etc/nginx/nginx.conf

        charset utf-8;
        root /var/www/html;
        index index.php;

        location ~ \.php$ {
            root /var/www/html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

※元々のコメントアウトを使うと「file not found」の洗礼を受ける

php-fpmの設定

sudo vi /etc/php-fpm.d/www.conf

    user = nginx
    group = nginx

起動

sudo /etc/init.d/nginx start
sudo /etc/init.d/php-fpm start