How to debug CGI over fcgiwrap/nginx

Server Fault Asked by Googlebot on December 16, 2020

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?

One Answer

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.

Answered by Jochen Buchholz on December 16, 2020

Add your own answers!

Related Questions

sudo twice become method for Ansible

1  Asked on January 3, 2022 by beam-davis


How to grant temporary access to server?

7  Asked on January 1, 2022 by paras-chopra


SSL Certificate Error: certificate_unknown

3  Asked on January 1, 2022 by user97693321


VPN connection reset

1  Asked on January 1, 2022 by bosnjak


Differences between mod_fastcgi and mod_proxy_fcgi

1  Asked on January 1, 2022 by reuben-debattista


UFW firewall rules for transmission-daemon on ubuntu 20.XX

2  Asked on January 1, 2022 by might_be_a_frog_or_horse


530 Permission Denied accessing FTP

1  Asked on January 1, 2022 by the-joatmon


Ask a Question

Get help from others!

© 2022 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir