![](/img/trans.png)
[英]FastCGI sent in stderr: “Primary script unknown” while reading response header from upstream
[英]FastCGI sent in stderr primary script unknown while reading response header from upstream
我在nginx.conf
upstream php-fpm7.0
{
server unix:/run/php-fpm/php7.sock;
}
我在conf.d/default.conf
location ~ \.php$ {
include php-fpm;
}
我在php-fpm
fastcgi_pass php-fpm7.0;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
# Additional variables
fastcgi_index index.php;
但我收到错误 404。当我发表评论时
#location ~ \.php$ {
# include php-fpm;
#}
文件可用
错误即使
location ~ \.php$ {
fastcgi_pass unix:/run/php-fpm/php7.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
FastCGI 在 stderr 中发送:从上游读取响应头时“主脚本未知”
如果不使用套接字,同样的错误:
fastcgi_pass 127.0.0.1:9000;
Centos 7
更新 1。
我使用后:
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param SCRIPT $fastcgi_script_name;
fastcgi_param FOLDER $document_root;
fastcgi_param FOLDER_SCRIPT $document_root$fastcgi_script_name;
我有$_SERVER['SCRIPT']
/index.php
和$_SERVER['FOLDER']
/home/www/max/www
和$_SERVER['FOLDER_SCRIPT']
/home/www/max/www/index.php
当我回来
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
所有作品。 神秘。
您始终可以通过将它们添加到 return 语句来检查 nginx 变量,例如:
location / {
return 200 $document_root$fastcgi_script_name;
}
打开 URL,将下载一个文件,文件将包含 nginx 返回的变量。 例如/srv/www/index.php
检查 nginx/php-fpm 用户组是否可以访问该文件:
须藤 -u www stat /srv/www/index.php
设置权限以读取和执行所有路径中 www 用户组的文件。
chmod g+x /srv
chmod g+x /srv/www
chmod g+x /srv/www/index.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.