This is similar to this question, which got no responses: How to debug CGI over fcgiwrap/nginx

How do I get perl errors to be automatically placed in the nginx error log? Right now, when there is any perl error, the following message goes in the error log:

2014/05/11 22:43:48 [error] 1730#0: *5 connect() failed (111: Connection refused) while connecting to upstream, client: localhost, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://", host: "localhost"

This is completely useless for debugging. I can use something like CGI::Carp qw{fatalsToBrowser}, but this is not optimal. It would be better to have it logged to a server-side file.


You can use this solution to send both STDOUT and STDERR to any log file you have access to write to, including your nginx error.log. Though it'd likely be more helpful to send it to a different file. Simply remove the STDOUT entries, if you only want STDERR output.

  • Please provide the relevant content here and link elsewhere for more details (and for attribution). – EEAA Dec 29 '15 at 3:17

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.