ÔçÆÚµÄCGI¼¼ÊõʹÍⲿ³ÌÐòÓëWeb·þÎñÆ÷Ö®¼ä½»»¥³ÉΪ¿ÉÄÜ£¬µ«CGI³ÌÐòÔËÐÐÔÚ¶ÀÁ¢µÄ½ø³ÌÖУ¬²¢¶Ôÿ¸öWebÇëÇó´´½¨Ò»¸ö½ø³Ì£¬ÕâÖÖ·½·¨·Ç³£ÈÝÒ×ʵÏÖ£¬µ«Ð§ÂʺܲÄÑÒÔÀ©Õ¹¡£Ãæ¶Ô´óÁ¿ÇëÇ󣬽ø³ÌµÄ´óÁ¿´´½¨ºÍÏûÍöʹ²Ù×÷ϵͳÐÔÄÜ´ó´óϽµ£¬´ËÍâÓÉÓÚµØÖ·¿Õ¼äÎÞ·¨¹²Ïí£¬Ò²ÏÞÖÆÁË×ÊÔ´ÖØÓá£
FastCGIʹÓóÖÐøµÄ£¨ÊØ»¤£©½ø³ÌÀ´´¦ÀíÒ»Á¬´®µÄÇëÇó£¬ÕâЩ½ø³ÌÓÉFastCGI·þÎñÆ÷¹ÜÀí£¬¶ø²»ÊÇweb·þÎñÆ÷¡£ µ±½øÀ´Ò»¸öÇëÇóʱ£¬web·þÎñÆ÷°Ñ»·¾³±äÁ¿ºÍÕâ¸öÒ³ÃæÇëÇóͨ¹ýÒ»¸ösocket±ÈÈçFastCGI½ø³ÌÓëweb·þÎñÆ÷(¶¼Î»ÓÚ±¾µØ£©»òÕßÒ»¸öTCP connection£¨FastCGI½ø³ÌÔÚÔ¶¶ËµÄserver farm£©´«µÝ¸øFastCGI½ø³Ì¡£
FPM½éÉÜ
FPM£¨FastCGI ½ø³Ì¹ÜÀíÆ÷£©ÓÃÓÚÌæ»» PHP FastCGI µÄ´ó²¿·Ö¸½¼Ó¹¦ÄÜ£¬¶ÔÓڸ߸ºÔØÍøÕ¾ÊǷdz£ÓÐÓõġ£
¾ßÌåÌØÐԺͰ²×°·½Ê½¿ÉÒÔ²ÎÕÕ¹Ù·½ÍøÕ¾£ºFastCGI ½ø³Ì¹ÜÀíÆ÷£¨FPM£©
¿ªÊ¼°É£¬GOGOGO
1.ÏÂÔؽâѹ¼°×¼±¸±àÒë»·¾³²»ÔÙ׸Êö
2.´´½¨FPMʹÓõÄÓû§ºÍ×é
[root@rhel6-1 php-5.6.31]# groupadd -r php
[root@rhel6-1 php-5.6.31]# useradd -r php -s /sbin/nologin -g php
3.ÅäÖñàÒëÑ¡Ïî
./configure --prefix /usr/local/php56 --with-config-file-path=/etc/ --with-config-file-scan-dir=/etc/php.d --with-libxml-dir --with-openssl --with-zlib --enable-mbstring --with-mysql --enable-fpm --with-fpm-user=php --with-fpm-group=php
4.±àÒë°²×°
make -j 2 & make install
5.¸ü¸ÄÏà¹ØÎļþµÄËùÊô×éºÍËùÊôÓû§
chown :php php56/ -R
ÅäÖÃFPMºÍApache
1.¸´ÖÆÏà¹ØÅäÖÃÎļþ
cp php.ini-production /etc/php.ini
chown :php /etc/php.ini
mkdir /etc/php.d;chown :php /etc/php.d
cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
chmod +x /etc/rc.d/init.d/php-fpm
2.±à¼fpmÅäÖÃÎļþ
cd /usr/local/php56/etc/
cp -p php-fpm.conf.default php-fpm.conf
vim php-fpm.conf //´ËÅäÖÃÎļþµÄ·¾¶¶¨ÒåÔÚÆô¶¯½Å±¾ÖÐ
3.ÆôÓÃfpm
service php-fpm start
¿´µ½ÈçÏÂÊä³ö²¢Ê¹ÓÃnetstat -tnlÑéÖ¤
Starting php-fpm done
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN //netstat -tnl ¿´µ½ÒѾ¼àÌýÁË9000¶Ë¿Ú
4.ÅäÖÃapche
ÕâÀïʹÓÃPROXYPASSMATCHµÄ·½Ê½£¬Ä¿Ç°Ó¦¸ÃÊÇÓÐ4ÖÖ·½Ê½¿ÉÒÔÅäÖõģ¬Í¼¸ö¼òµ¥¾ÍËüÁË¡£
ÏÈÌî¸ö¿Ó£¬ºÃÏñ֮ǰ±àÒëhttpdµÄʱºòûÓбàÒëfcgiÄ£¿é¡.ÎÒµÄÌì°¡¡ÔõôÄÇô¶à¿Ó¡
/root/httpd-2.4.27/modules/proxy
/usr/local/httpd24/bin/apxs -c -i -a mod_proxy_fcgi.c
±à¼httpdÅäÖÃÎļþ£¬È¡Ïûproxy_moduleÕâ¸öÄ£¿éÇ°ÃæµÄ#×¢ÊÍ·û²¢Ìí¼ÓÈçÏÂÄÚÈÝ£º
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/path/to/webroot/$1 //¸ù¾Ý×Ô¼ºµÄÍøվĿ¼Ð޸ķ¾¶
È»ºóÖØÆôapache²âÊÔ£¬Í깤¡£
×ܽá
×ÜËã¸øFCGIÐÎʽµÄphpÍæÁËһϣ¬»ù±¾ÉÏ»¹ÊÇÄÜÀí½âÕâÖÖ²Ù×÷·½Ê½µÄ£¬FCGIÖ÷ÒªÊÇ¿ÉÒÔ½«php°²×°µ½µ¥¶ÀµÄÖ÷»ú£¬È»ºó½«ÍøվʹÓÃNFSµÄ·½Ê½½øÐд洢¡£àÅ£¬´ó¸Å¾ÍÊÇÕâÑù£¬°¦£¬ÓÖ¿ì11µãÁË£¬Ë¯¾õ°É¡£
±¾ÎÄתÔØ×Ô£ºhttp://www.linuxprobe.com/apache-fcgi.html
Ãâ·ÑÌṩ×îÐÂLinux¼¼Êõ½Ì³ÌÊé¼®£¬Îª¿ªÔ´¼¼Êõ°®ºÃÕßŬÁ¦×öµÃ¸ü¶à¸üºÃ£¬¿ªÔ´Õ¾µã£ºhttp://www.linuxprobe.com/
weijhon ÓÚ 2017-12-10 19:52:02·¢±í:
mark
qyh1234 ÓÚ 2017-11-29 09:28:34·¢±í:
лл·ÖÏí
Ronny ÓÚ 2017-11-23 10:41:01·¢±í:
apacheʹÓÃfcgiÅäÖÃPHP»·¾³µÄ²½Öè