Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running a Debian server with nginx chrooted in /var/chroot/nginx. It works wonderfully, but I'd like to be able to run cgit and host my gitolite repositories.

When it was out of the chroot it would give me the same error as it is giving me now, which is this:

2012/12/08 14:25:19 [error] 9179#0: *3 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

I'm fairly sure that this is a problem with fastcgi... here are the relevant lines in my nginx.conf:

server {
    listen 80;
    server_name git.url.tld;
    access_log /var/log/nginx/cgit.access.log;
    error_log /var/log/nginx/cgit.error.log;
    root /var/www/htdocs/cgit;

        location ~* ^.+\.(css|png|ico)$ {
            root /var/www/htdocs/cgit;
            expires 30d;

        location / {
    root /var/www/htdocs/cgit;
            fastcgi_param   SCRIPT_NAME     cgit.cgi;
    fastcgi_param   DOCUMENT_ROOT   /var/www/htdocs/cgit;
            fastcgi_param   PATH_INFO       $uri;
            fastcgi_param   QUERY_STRING    $args;
            fastcgi_pass    unix:/tmp/cgi.sock;

Any clues? Fastcgi, fcgi-wrap, etc. are all outside of the chroot, because having cgit, fastcgi, and gitolite in the chroot seemed a bit excessive. fastcgi has a socket open at /var/chroot/nginx/tmp/cgi.sock.

Thanks for your help!!

share|improve this question
May be related with… and… but none solved the issue for me :( – gueux Jan 13 '13 at 18:52

This is probably a bug with the version of fcgiwrap found on debian squeeze (1.0-1+squeeze1). See

Upgrading to fcgiwrap 1.0.3-3 solved the issue for me.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.