1. 下載 & 解壓縮
cd /home/nginx/src wget http://www.lighttpd.net/download/spawn-fcgi-1.6.3.tar.gz tar xvf spawn-fcgi-1.6.3.tar.gz cd spawn-fcgi-1.6.3.tar.gz
2. 安裝
./configure make make install
3. 設定
vi /etc/init.d/spawn-fcgi
#! /bin/sh
# Source SuSE config (if still necessary, most info has been moved)
. /etc/rc.status
# Check for missing binaries (stale symlinks should not happen)
FCGI_BIN=/usr/local/bin/spawn-fcgi
test -x $FCGI_BIN || exit 5
PHPCGI_BIN=/home/php/bin/php-cgi
# First reset status of this service
rc_reset
case "$1" in
start)
echo -n "Starting PHP-CGI"
#startproc $FCGI_BIN -a 127.0.0.1 -C 5 -p 9000 -f /usr/bin/php-cgi
startproc /usr/bin/sudo -u wwwrun $FCGI_BIN -C 32 -s /tmp/spawn.sock -f $PHPCGI_BIN
#rc_status
;;
stop)
echo -n "Stopping PHP_CGI"
killproc -TERM $PHPCGI_BIN
rc_status -v
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
# Remember status and be quiet
#rc_status
;;
status)
echo -n "Checking for service PHP-CGI: "
## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0.
# Return value is slightly different for the status command:
# 0 - service running
# 1 - service dead, but /var/run/ pid file exists
# 2 - service dead, but /var/lock/ lock file exists
# 3 - service not running
# NOTE: checkproc returns LSB compliant status values.
checkproc $PHPCGI_BIN
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
rc_exit
4. 在 nginx.conf 加上
5. 讓 php-cgi 跑起來, 寫個 phpinfo() 查看結果
location ~\.php$ {
fastcgi_pass unix:///tmp/spawn.sock;
fastcgi_buffer_size 32k;
fastcgi_buffers 32 32k;
include fastcgi.conf;
}
5. 讓 php-cgi 跑起來, 寫個 phpinfo() 查看結果
/etc/init.d/spawn-fcgi start
cf :
沒有留言:
張貼留言