Re: [Cgi-devel] Fastcgi - echo example
Status: Beta
Brought to you by:
drrngrvy
From: <jc...@ol...> - 2010-06-16 13:22:19
|
Hello Darren, > I think this might be due to nginx sending through empty parameters at the > end of a FCGI_PARAMS packet. Thanks for the patch. I applied it and the problem is gone. Excellent! Below, I am describing my setup for nginx and FastCGI / CGI C++ Librarym in case someone is interested. Step 1 nginx.conf http { ... server { ... location ~ \.toff$ { include /usr/local/nginx/conf/fastcgi.conf; fastcgi_pass 127.0.0.1:9000; } } location is written that way because it so happens that all my fasctgi app have an .toff extension Step 2 Since nginx does not serve cgi scripts, it is up to the developer to find a way to have nginx and the CGI app. I am using supervisord, which is "a client/server system that allows its users to control a number of processes on UNIX-like operating systems" (see supervisord.org). /etc/supervisord.conf ... 131 [fcgi-program:chat] 132 command=/path/chat.toff 133 socket=tcp://127.0.0.1:9000 134 process_name=%(program_name)s_%(process_num)02d 135 numprocs=1 136 priority=999 137 autostart=true 138 autorestart=unexpected 139 startsecs=1 140 startretries=3 141 exitcodes=0,2 142 stopsignal=QUIT 143 stopwaitsecs=10 Step 3 to compile a FastCGI / CGI C++ Library, I do the following: g++ -Wall ... supervisorctl restart chat:* JCR > Hi there, > > On 15 June 2010 22:53, <jc...@ol...> wrote: > >> Hello, >> >> I am using the cgi-0.7.1 on a Centos box with nginx as webserver. I am >> also using supervisord to keep my app chat.toff up. >> chat.toff contains the code of the Fastcgi examples - Echo. >> > > Interesting - that's not a platform I've tried the library with before. > > >> If I type example.com/chat.toff? >> it works fine >> but if I type example.com/chat.toff >> it fails with the following information in the log of nginx: >> >> 2010/06/15 17:41:07 [error] 31508#0: *688 recv() failed (104: Connection >> reset by peer) while reading response header from upstream, client: >> 70.48.64.188, server: *.example.com, request: "GET /chat.toff HTTP/1.1", >> upstream: "fastcgi://127.0.0.1:9000", host: "www.example.com:8080" >> >> Any idea What the problem is? >> > > I think this might be due to nginx sending through empty parameters at the > end of a FCGI_PARAMS packet. > > Can you try the attached patch to see if it helps? > > In any case, I am quite excited to have a CGI library around boost... >> >> Thank you >> > > Good to hear it! Thanks for the feedback. > > Cheers, > Darren > |