Nginx和CGI不工作?我需要帮助吗?

时间:2017-06-26 12:16:24

标签: nginx cgi fastcgi

我有一个带有Nginx Web服务器的Linux Debian Weezy系统,我想在我的服务器上访问*.cgi脚本。

我已经安装了fastcgiwrapper "fcgiwrap"

我的配置如下:

ngnix serverconfig:

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;
   }

  ....
}  

fastcgi_config:

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;

但是我无法运行一些*.cgi个文件

我收到以下错误

  

502 Bad GATEWAY

然后是一个ngnix-log条目:

  

FastCGI stdout从上游读取响应头,client ::: ffff:5.10.0.147,server :, request:" GET /cgi-bin/test.cgi HTTP / 1.1",上游: " fastcgi:// unix:/var/run/fcgiwrap.socket:",主持人:" mein host"

cgi文件夹中的cgi脚本具有755的权限,其所有者和组是www-data(我的webuser)

我该怎么做才能调用一些cgi脚本?

0 个答案:

没有答案