nginx下的spawn-fcgi管理php-cgi配置求解释

加咧个油 发布于 2011/09/08 09:51
阅读 2K+
收藏 1

前提:

都已经yum install 了php nginx spawn-fcgi

第一种配置:

/etc/sysconfig/spawn-fcgi

FASTCGI_USER=nginx
FASTCGI_GROUP=nginx
SOCKET=/var/run/spawn-fcgi.sock
PIDFILE=/var/run/spawn-fcgi.pid
PHP5_SOCKET=/var/run/php-fcgi.sock
CHILDREN=6
PHP5=/usr/bin/php-cgi
MODE=0600
OPTIONS="-s $PHP5_SOCKET -S -M $MODE -P $PIDFILE -C $CHILDREN -u $FASTCGI_USER -g $FASTCGI_GROUP -f $PHP5"
chkconfig spawn-fcgi on
service spawn-fcgi start
nginx中的php配置

        location ~ \.php$ {
            root           html;
            #fastcgi_pass   127.0.0.1:9000;
	    fastcgi_pass unix:/var/run/php-fcgi.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html$fastcgi_script_name;
            include        fastcgi_params;
        }
第二种:

vi /etc/rc.local
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -f /usr/bin/php-cgi -P /var/run/fastcgi-php.pid
nginx配置

        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
	    #fastcgi_pass unix:/var/run/php-fcgi.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html$fastcgi_script_name;
            include        fastcgi_params;
        }

一个是fastcgi_pass unix:/var/run/php-fcgi.sock;

一个是fastcgi_pass 127.0.0.1:9000;

求给俺科普一下吧。

返回顶部
顶部