I serve executable scripts (mainly in C) through fcgiwrap connected with nginx. Since the scripts are complied, I can get the coding errors during compilation, but sometimes I receive CGI errors simply stating

An error occurred while reading CGI reply (no response received)

Is there any debugging approach to identify what is wrong with the CGI request/proces?

How can I set a debugging system to deliver the errors into the nginx log?

  • Had the same error a few days ago. In my case this was caused by a segfault in the c++-program. Unfortunately the nginx-logs aren't very helpful, so I have to use my internal logger. – jvlkr Apr 19 '16 at 7:22

I put a sleep(10); in my C program. Start GDB with your program and set a breakpoint to the command behind the sleep. Then submit your cgi programm in a browser and enter ps axu | grep prog. Type attach <pid> in gdb, you need to do this fast, you have only 10 seconds. Then you can debug your program.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.