title: Nginx and CGI is not working? i need help pleace?
body: <p>I have a Linux Debian Weezy system with a Nginx web server and I want to access <code>*.cgi</code> scripts on my server.</p>
  
  <p>I have installed <code>fastcgiwrapper "fcgiwrap"</code>.</p>
  
  <p>My config looks like this:</p>
  
  <p><strong>ngnix serverconfig:</strong></p>
  
  <pre><code>server{
  ....
  location /cgi-bin/ {
  
       # Disable gzip (it makes scripts feel slower since they have to
       # complete
       # before getting gzipped)
  gzip off;
       # Set the root to /usr/lib (inside this location this means that we are
       # giving access to the files under /usr/lib/cgi-bin)
  root  /media/33d9d5e4-a135-4b5b-a1f0-6394a116bf32/www/server1;  #thats my webserver-root
       # Fastcgi socket
  fastcgi_pass  unix:/var/run/fcgiwrap.socket;
       # Fastcgi parameters, include the standard ones
  include /etc/nginx/fastcgi_params;
       # Adjust non standard parameters (SCRIPT_FILENAME)
  fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
     }
  
    ....
  }  
  </code></pre>
  
  <p><strong>fastcgi_config:</strong></p>
  
  <pre><code>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_FILENAME         $document_root$fastcgi_script_name;
  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   SERVER_NAME             $host;
  fastcgi_param   HTTPS                   $https if_not_empty;
  
  # PHP only, required if PHP was built with --enable-force-cgi-redirect
  fastcgi_param   REDIRECT_STATUS         200;
  </code></pre>
  
  <p>but I cant run some of the <code>*.cgi</code> files </p>
  
  <p>I get the below error</p>
  
  <blockquote>
    <p>502 Bad GATEWAY</p>
  </blockquote>
  
  <p>and then an ngnix-log entry:</p>
  
  <blockquote>
    <p>FastCGI stdout while reading response header from upstream, client: ::ffff:5.10.0.147, server: , request: "GET /cgi-bin/test.cgi HTTP/1.1", upstream: "fastcgi://unix:/var/run/fcgiwrap.socket:", host: "mein host"</p>
  </blockquote>
  
  <p>The cgi-scripts in the cgi-folder have permissions to 755 and the owner and group of them are www-data (that's my webuser)</p>
  
  <p>What must I do to call some of the cgi-scripts?</p>