Failing to get CGI error log in nginx + fastcgi + c++

387 views Asked by At

I'm migrating a server from Apache + mod_cgi to nginx + fastcgiwrap, and for some reason the application cerr doesn't show up in the nginx error.

The nginx setting:

server {
    error_log /var/log/nginx/test-error.log;
    # ...
    location ~ \.cgi$ {
        # ...
        fastcgi_intercept_errors on;
    }
}

The error log permissions:

~# ls -lA /var/log/nginx/test-error.log
-rwxrwxrwx 1 www-data www-data 0 Jun 17 21:27 /var/log/nginx/test-error.log

The fastcgi "-f" flag:

~# head -39 /etc/init.d/fcgiwrap | tail -1
DAEMON_OPTS="-f"        # By default we redirect STDERR output from executed

The application by itself:

#include <iostream>

int main( void ) {
    std::cout << "Content-Type: text/html; charset=UTF-8\n\n";
    std::cout << "Hello World.";
    std::cerr << "Should appear on the nginx log..." << std::endl;
    return 0;
}

The application runs perfectly, but no joy getting the error log to be written, am I missing something ?

0

There are 0 answers