あらかじめphpをcgi用(--with-apxs をつけずに)でインストールしておくこと(php-cgi バイナリが必要)。
fastcgiはepelにspawn-fcgi があるのでこれを使う。
# yum install --enablerepo=epel spawn-fcgi # vim /etc/sysconfig/spawn-fcgi #### socket, php-cgi のPATHなどを設定 SOCKET=/var/run/php-fcgi.sock OPTIONS="-u nginx -g nginx -s $SOCKET -S -M 0600 -C 32 -F 1 -P /var/run/spawn-fcgi.pid -- /usr/local/bin/php-cgi"
- nginx.conf
location ~ \.php($|/) { include fastcgi_params; fastcgi_pass unix:/var/run/php-fcgi.sock; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(/.*)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; }
# /etc/init.d/nginx restart # /etc/init.d/spawn-fcgi start