CGI reply error on nginx server using fcgiwrap

Upvote picture Upvote · Aug 24, 2012 · Viewed 9.8k times · Source

I have a nginx server running on debian wheezy. I have working OTRS installation. But our old perl-fcgi wrapper was interferring with some other important process so we desided to choose fcgiwrap package: http://www.haschmi.de/de/otrs/otrs-on-nginx.html

So I removed the old wrapper and installed the new one. The old wrapper had

fastcgi_pass 127.0.0.1:8999;

and the new one

fastcgi_pass unix:/var/run/fcgiwrap.socket;

Here is the complete config

server {
   listen ip:80;

    server_name support.test.com;

    root /opt/otrs/var/httpd/htdocs;

    index index.html;
    location /otrs-web {
        gzip on;
        alias /opt/otrs/var/httpd/htdocs;
    }

   location ~ ^/otrs/(.*\.pl)(/.*)?$ {
   #try_files $uri =404;
    gzip off;
    fastcgi_pass unix:/var/run/fcgiwrap.socket;
    fastcgi_index index.pl;
    fastcgi_param SCRIPT_FILENAME /opt/otrs/bin/fcgi-bin/$1;


    fastcgi_param QUERY_STRING $query_string;
    fastcgi_param REQUEST_METHOD $request_method;
    fastcgi_param CONTENT_TYPE $content_type;
    fastcgi_param CONTENT_LENGTH $content_length;
    fastcgi_param GATEWAY_INTERFACE CGI/1.1;
    fastcgi_param SERVER_SOFTWARE nginx;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_param REQUEST_URI $request_uri;
    fastcgi_param DOCUMENT_URI $document_uri;
    fastcgi_param DOCUMENT_ROOT $document_root;
    fastcgi_param SERVER_PROTOCOL $server_protocol;
    fastcgi_param REMOTE_ADDR $remote_addr;
    fastcgi_param REMOTE_PORT $remote_port;
    fastcgi_param SERVER_ADDR $server_addr;
    fastcgi_param SERVER_PORT $server_port;
    fastcgi_param SERVER_NAME $server_name;
   }
}

When I visit our OTRS everything works. But as son as I submit the login form I get

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

Any ideas what is wrong? How can I solve this?

Answer

Kirill Kay picture Kirill Kay · Oct 7, 2012

The current Ubuntu reps (12.04) do not include a proper fcgiwrap version.

You need to compile fcgiwrap directly from https://github.com/gnosek/fcgiwrap and use -f option to run the wrapper. It will cause the err_log to be redirected to server error.log. To change fcgiwrap startup options edit /etc/init.d/fcgiwrap and uncomment/modify the following line:

DAEMON_OPTS="-f" 

Restart fcgiwrap after this:

service fcgiwrap restart