【发布时间】:2016-08-08 12:10:50
【问题描述】:
我有一个简单的脚本 cpuinfo.sh 可以运行并且可执行。
我遇到了一个错误
*224 FastCGI 在 stderr 中发送:“无法获取脚本名称,是否设置了 DOCUMENT_ROOT 和 SCRIPT_NAME(或 SCRIPT_FILENAME)并且脚本可执行?”从上游读取响应头时,客户端:86.44.146.39,服务器:staging.example.com,请求:“GET /cpuinfo.sh HTTP/1.1”,上游:“fastcgi://unix:/var/run/fcgiwrap.套接字:”,主机:“staging.example.com”
nginx 设置是
location ~ (\.cgi|\.py|\.sh|\.pl|\.lua)$ {
gzip off;
autoindex on;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include fastcgi_params;
fastcgi_param DOCUMENT_ROOT /home/balance/balance-infosystems-web/scripts/;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
我期待 fcgiwrap 执行
/home/balance/balance-infosystems-web/scripts/cpuinfo.sh
我硬编码了要调试的脚本路径,但我仍然遇到同样的错误。
location ~ (\.cgi|\.py|\.sh|\.pl|\.lua)$ {
gzip off;
autoindex on;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include fastcgi_params;
fastcgi_param DOCUMENT_ROOT /home/balance/balance-infosystems-web/scripts/;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /home/balance/balance-infosystems-web/scripts/cpuinfo.sh;
}
需要在 nginx 服务器配置中进行哪些更改才能正确执行脚本?
【问题讨论】: