概要†nginxでPHPを動かす方法です。 内容†1.remiまたはepelのリポジトリを導入する。†2.php-fpmをインストール†# yum install php-fpm # php-fpm -v PHP 5.3.3 (fpm-fcgi) (built: Dec 11 2013 03:32:01) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies # /etc/init.d/php-fpm start php-fpm を起動中: [ OK ] # chkconfig php-fpm on # chkconfig php-fpm --list php-fpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off 3.nginxでphpをCGIとして稼働するように設定する。†# cd /etc/nginx/conf.d/ # vi server.conf 以下のコメントアウトを解除 #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} ↓ location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /ドキュメントルート$fastcgi_script_name; include fastcgi_params; } # /etc/init.d/nginx configtest nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful # service nginx restart 4.テスト†# cd ドキュメントルート # vi phpinfo.php <?php phpinfo(); ?> |