Forum: NGINX otrs on nginx with fcgiwrap

Posted by PascalTurbo (Guest)
on 2013-01-13 16:40
(Received via mailing list)
Hi There,

I'm trying to run OTRS on Debian with nginx and fcgiwrap. But all I get 
is
this error:

FastCGI sent in stderr: "Cannot get script name, is DOCUMENT_ROOT and
SCRIPT_NAME set
and is the script executable?" while reading response header from 
upstream,

client: 123.123.123.123,
server: support.example.com,
request: "GET /otrs/index.pl HTTP/1.1",
upstream: "fastcgi://unix:/var/www/sockets/fcgiwrap.socket:",
host: "support.example.com", referrer: "http://support.examle.com/"
Here's my configuration:

server {
    server_name support.example.com;

    access_log      /var/www/support/log/access.log;
    access_log      /var/log/nginx/access.log;
    error_log       /var/www/support/log/error.log info;

    fastcgi_buffers 8 16k;
    fastcgi_buffer_size 32k;

    root /var/www/support/otrs/var/httpd/htdocs;

    index index.html;

    location = /favicon.ico {
            access_log      off;
            log_not_found   off;
    }

    location /otrs-web/ {
            alias /var/www/support/otrs/var/httpd/htdocs;
    }

    location ~ ^/otrs/(.*\.pl)(/.*)?$ {
            gzip off;

            fastcgi_pass unix:/var/www/sockets/fcgiwrap.socket;

            fastcgi_index index.pl;

            fastcgi_param SCRIPT_FILENAME
/var/www/support/otrs/bin/fcgi-bin/$1;

            include fastcgi_params;

    }
}
and the fastcgi_params:

fastcgi_connect_timeout 65;
fastcgi_send_timeout    180;
fastcgi_read_timeout    180;

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   SCRIPT_FILENAME         $request_filename;
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   GATEWAY_INTERFACE       CGI/1.1;
fastcgi_param   SERVER_SOFTWARE         nginx/$nginx_version;

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;

fastcgi_param   HTTPS                   $https;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param   REDIRECT_STATUS         200;

Any idea what could be the problem?

Kind regards
Pascal

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,235011,235011#msg-235011
Posted by Francis Daly (Guest)
on 2013-01-13 22:52
(Received via mailing list)
On Sun, Jan 13, 2013 at 10:39:14AM -0500, PascalTurbo wrote:

Hi there,

> I'm trying to run OTRS on Debian with nginx and fcgiwrap. But all I get is
> this error:
>
> FastCGI sent in stderr: "Cannot get script name, is DOCUMENT_ROOT and
> SCRIPT_NAME set
> and is the script executable?" while reading response header from upstream,

All untested, but:

that message suggests that your fastcgi server (==fcgiwrap) uses
DOCUMENT_ROOT and SCRIPT_NAME to decide which file to process.

Which file do you want fcgiwrap to process?

What is DOCUMENT_ROOT? What is SCRIPT_NAME? Does combining them lead
you to that file?

Is that file executable?


It may be that switching to a fcgiwrap that uses SCRIPT_FILENAME is the
simplest fix for you.

Or maybe your fcgiwrap does already use SCRIPT_FILENAME, but it uses
the last one that it receives -- in that case putting your "include"
line before your "fastcgi_param" line may be sufficient.

You must match your nginx "fastcgi_param" configuration to whatever it
is that your fastcgi server requires. Your fastcgi server documentation
may give a better indication of what that is.

  f
--
Francis Daly        francis@daoine.org
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.