nginx c++ fastcgi

×÷Õß: haolifengwang 2012-03-25 11:09:13
Ç°Ò»¶ÎÑо¿apache2+fastcgiºó£¬·¢ÏÖÓôíÁË£¬ÓõÄÊÇnginx+fastcgi£¬½á¹û¼±¼±Ã¦Ã¦¶¼¸Ä¹ýÀ´¡£·¢ÏֺܶණÎ÷¶¼²»Ò»Ñù£¬ÎÞÄκÎÖ»ÄÜ´ÓÍ·À´ÁË¡£¾­¹ý¼¸ÌìµÄÍ»»÷£¬ÔÚÍøÉÏÈ纣һ°ãµÄ×ÊÁÏ£¬¼ìÕæȥᣬÕÒµ½ÁËÔÝʱ³É¹¦¶¼·½·¨¡£ ÍøÉϺܶàÈËÓÃphp£¬Ð´µÄ×ÊÁÏÒ²ÊǹØÓÚÅäÖÃphpµÄ¡£¿ÉϧÎÒÓÃc++£¬Ö»Äܲο¼ÍøÉϵÄ×ÊÁÏ×Ô¼º×ÁÄ¥¡£»¹ºÃ×ÜËãÓÐËùÊÕ»ñ¡£ÏÂÁоÍÊÇÔÝʱµÄ×¢ÒâÊÂÏî¡£
1. fcgiwrapÓëspawn-fcgiµÄ¹Øϵ¡£spawn-fcgiÊÇÍøÉÏÏֳɵķâ×°ÁËfcgiwrapµÄ¹¤¾ß£¬¿ÉÒÔÏÂÔØÖ±½ÓʹÓá£Èç¹ûÏÂÔØfcgiwrap£¬¿ÉÒÔ×Ô¼º±àд½Å±¾¡£ÓÐЩÌû×ÓÈÃspawn-fcgiÆô¶¯fcgiwrapÊÇ´íÎóµÄ¡£ÎÒÆð³õÒ²ÔÚÕâ¸ö·½Ãæ±»ÕâЩ¿É¶ñµÄÈËÎ󵼡£

2. ·þÎñÆ÷¶ÔfastcgiµÄÖ§³Ö¡£apache2Ìí¼Ólib-apache2-mode-fastÄ£¿éºó£¬½«Ð´ÍêµÄ.cgiÎļþ·Åµ½Ä¿Â¼Ï¼´¿É¡£¶ønginx±ØÐëʹÓÃspawn-fcgiÆô¶¯.cgiÎļþ¡£spawn-fcgiÆô¶¯Ê±ÒªÖÁÉÙÓõ½·þÎñÆ÷£¬¶Ë¿ÚºÍ.cgiÎļþµÄµØÖ·£¬²¢ÇÒÔÚnginxµÄÅäÖÃÎļþÖн«fast_pass¸³ÖµÎª·þÎñÆ÷ºÍ¶Ë¿Ú¡£

3. ÔÚapache2ʹÓÃfastcgiʱ£¬coutÊÇÓÐЧµÄ¡£¶ønginxʹÓÃfastcgiʱ²»ÄÜʹÓÃcoutÖ»ÄÜʹÓÃprintf

Ïà¹Ø×ÊѶ