FastCGI em linguagem C com Nginx

Estou tentando executar um aplicativo fastcgi escrito em linguagem C atrás do servidor web Nginx. O navegador da web nunca termina o carregamento e a resposta nunca é concluída. Não sei como abordá-lo e depurar. Qualquer insight seria apreciado.

O aplicativo olá mundo foi retirado do fastcgi.com e simplificado para ter a seguinte aparência:

#include "fcgi_stdio.h"
#include <stdlib.h>

int main(void)
{

 while(FCGI_Accept >= 0)
 {
  printf("Content-type: text/html\r\nStatus: 200 OK\r\n\r\n");

 }

  return 0;
}

O executável de saída é executado com um dos seguintes:

cgi-fcgi -connect 127.0.0.1:9000 a.out

ou

spawn-fcgi -a120.0.0.1 -p9000 -n ./a.out

A configuração do Nginx é:

server {
        listen   80;
        server_name _;

 location / {
                        # host and port to fastcgi server
                        root   /home/user/www;
                        index  index.html;

                        fastcgi_pass 127.0.0.1:9000;
 }
}

questionAnswers(5)

yourAnswerToTheQuestion