title: Setting up fastcgi with nginx
body: <p>I am using following c code </p>
  
  <pre><code>#include &lt;fcgi_stdio.h&gt;
  
  /*
   * 
   */
  int main(int argc, char** argv) {
      while (FCGI_Accept() &gt;= 0) {
          printf("Content-Type: text/plain\r\n");
          printf("Hello world in C\n");
      }
  
      return 0;
  }
  </code></pre>
  
  <p>I am using following command </p>
  
  <pre><code> spawn-fcgi -a127.0.0.1 -p9000 -n ./a.out
  </code></pre>
  
  <p>Where  spawn-fcgi , I installed using fedora 15 repo. </p>
  
  <p>Nginx config is:</p>
  
  <pre><code>   location / {
          root html;
          fastcgi_pass 127.0.0.1:9000;
          }
  </code></pre>
  
  <p>I am getting following error:</p>
  
  <pre><code>2012/02/13 16:15:45 [error] 17998#0: *1 upstream closed prematurely FastCGI stdout while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /hello HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1:8081"
  </code></pre>
  
  <p>What can be wrong ?</p>