<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        font-size:10.5pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML \9884\8BBE\683C\5F0F Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:SimSun;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.apple-style-span
        {mso-style-name:apple-style-span;}
span.HTMLChar
        {mso-style-name:"HTML \9884\8BBE\683C\5F0F Char";
        mso-style-priority:99;
        mso-style-link:"HTML \9884\8BBE\683C\5F0F";
        font-family:SimSun;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
/* Page Definitions */
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=ZH-CN link=blue vlink=purple style='text-justify-trim:punctuation'><div class=WordSection1><p class=MsoNormal><span class=apple-style-span><span lang=EN-US style='font-size:13.5pt;font-family:"Arial","sans-serif";color:black'>Hello nginx,<o:p></o:p></span></span></p><p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span class=apple-style-span><span lang=EN-US style='font-size:13.5pt;font-family:"Arial","sans-serif";color:black'>I have a Fastcgi C++ program as follow:</span></span><span lang=EN-US style='font-size:13.5pt;font-family:"Arial","sans-serif";color:black'><br clear=all><br clear=all><span class=apple-style-span><o:p></o:p></span></span></p><div style='mso-element:para-border-div;border:solid #C4C6A2 1.0pt;padding:6.0pt 6.0pt 6.0pt 6.0pt;background:#FEFFEC'><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>1 #include &quot;fcgi_stdio.h&quot;<o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>&nbsp; 2 #include &lt;stdlib.h&gt;<o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>&nbsp; 3 <o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>&nbsp;&nbsp;4 int main(void)<o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>&nbsp; 5 {<o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>&nbsp; 6&nbsp;&nbsp;&nbsp;&nbsp; int count = 0;<o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp; while(FCGI_Accept() &gt;= 0)<o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&quot;Content-type: text/html\r\n&quot;<o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>&nbsp; 9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;\r\n&quot;<o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'> 10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;&lt;h1&gt;Tiny3&lt;/h1&gt;&quot;<o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'> 11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;&lt;h1&gt;FastCGI World!&lt;/h1&gt;&quot;<o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'> 12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;Request number %d running on host &lt;i&gt;%s&lt;/i&gt;\n&quot;,<o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'> 13&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ++count, getenv(&quot;SERVER_NAME&quot;));<o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'> 14&nbsp;&nbsp;&nbsp;&nbsp; return 1;<o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'> 15 }</span><span lang=EN-US><o:p></o:p></span></pre></div><p class=MsoNormal><span lang=EN-US style='font-size:13.5pt;font-family:"Arial","sans-serif";color:black'><br clear=all><br><span class=apple-style-span>then i have modified the Nginx conf file</span><br clear=all></span><span class=apple-style-span><span lang=EN-US style='font-size:13.5pt;font-family:"Arial","sans-serif"'><o:p></o:p></span></span></p><div style='mso-element:para-border-div;border:solid #C4C6A2 1.0pt;padding:6.0pt 6.0pt 6.0pt 6.0pt;background:#FEFFEC'><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>30&nbsp;&nbsp;&nbsp;&nbsp; upstream fastcgiends{ <o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>31&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; server 127.0.0.1:9110 weight=1 max_fails=2 fail_timeout=30s; <o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; server 127.0.0.1:9111 weight=1 max_fails=2 fail_timeout=30s; <o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>33&nbsp;&nbsp;&nbsp;&nbsp; }</span><span lang=EN-US><o:p></o:p></span></pre></div><p class=MsoNormal><span lang=EN-US style='font-size:13.5pt;font-family:"Arial","sans-serif";color:black'><br clear=all><br clear=all></span><span class=apple-style-span><span lang=EN-US style='font-size:13.5pt;font-family:"Arial","sans-serif"'><o:p></o:p></span></span></p><div style='mso-element:para-border-div;border:solid #C4C6A2 1.0pt;padding:6.0pt 6.0pt 6.0pt 6.0pt;background:#FEFFEC'><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>location =/3.cgi&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#fastcgi_pass 127.0.0.1:9110; <o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fastcgi_pass fastcgiends; <o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span><span lang=EN-US><o:p></o:p></span></pre></div><p class=MsoNormal><span lang=EN-US style='font-size:13.5pt;font-family:"Arial","sans-serif";color:black'>If I use </span><span lang=EN-US style='color:black'>fastcgi_pass 127.0.0.1:9110;</span><span lang=EN-US style='font-size:13.5pt;font-family:"Arial","sans-serif";color:black'>, &nbsp;it can work normal, but I want to use the nginx&#8217;s balance performance ,so to use the</span><span lang=EN-US style='color:black'> fastcgi_pass fastcgiends;,</span><span lang=EN-US style='font-size:13.5pt;font-family:"Arial","sans-serif";color:black'> it can&#8217;t work.<br clear=all><br clear=all><br clear=all><span class=apple-style-span>start the spawn-fcgi command :</span><br clear=all></span><span class=apple-style-span><span lang=EN-US style='font-size:13.5pt;font-family:"Arial","sans-serif"'><o:p></o:p></span></span></p><div style='mso-element:para-border-div;border:solid #C4C6A2 1.0pt;padding:6.0pt 6.0pt 6.0pt 6.0pt;background:#FEFFEC'><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>spawn-fcgi&nbsp; -a 127.0.0.1 -p 9110 -f ./tiny3 -P ./pid/fastcgi_9110.pid<o:p></o:p></span></pre><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'>spawn-fcgi&nbsp; -a 127.0.0.1 -p 9111 -f ./tiny3 -P ./pid/fastcgi_9111.pid</span><span lang=EN-US><o:p></o:p></span></pre></div><p class=MsoNormal><span lang=EN-US style='font-size:13.5pt;font-family:"Arial","sans-serif";color:black'><br clear=all><br><span class=apple-style-span>but I found i can't query it from the web</span></span><span class=apple-style-span><span lang=EN-US style='font-size:13.5pt;font-family:"Arial","sans-serif"'><o:p></o:p></span></span></p><div style='mso-element:para-border-div;border:solid #C4C6A2 1.0pt;padding:6.0pt 6.0pt 6.0pt 6.0pt;background:#FEFFEC'><pre style='background:#FEFFEC;border:none;padding:0cm'><span lang=EN-US style='color:black'><a href="http://122.36.180.89:9095/3.cgi" target="_blank"><span style='color:#355F35'>http://122.36.180.89:9095/3.cgi</span></a></span><span lang=EN-US><o:p></o:p></span></pre></div><p class=MsoNormal><span lang=EN-US style='font-size:13.5pt;font-family:"Arial","sans-serif";color:black'><br clear=all><br><span class=apple-style-span>and does anyone konw sth about this problem ?&nbsp; <o:p></o:p></span></span></p><p class=MsoNormal><span class=apple-style-span><span lang=EN-US style='font-size:13.5pt;font-family:"Arial","sans-serif";color:black'><o:p>&nbsp;</o:p></span></span></p><p class=MsoNormal><span lang=EN-US>It is posted at&nbsp; <a href="http://forum.nginx.org/read.php?2,157079">http://forum.nginx.org/read.php?2,157079</a><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span class=apple-style-span><span lang=EN-US style='font-size:13.5pt;font-family:"Arial","sans-serif";color:black'>Thanks<o:p></o:p></span></span></p><p class=MsoNormal><span class=apple-style-span><span lang=EN-US style='font-size:13.5pt;font-family:"Arial","sans-serif";color:black'>Kevinew<o:p></o:p></span></span></p><p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p></div></body></html>