【发布时间】:2021-12-19 10:45:15
【问题描述】:
所以有a site,我正在配置我的 Ubuntu 服务器。大约 2 年前我做过一次,但从那以后发生了很多变化。比如现在有php8.0,owncloud还不支持。无论如何,我有 php7.4,我正在尝试配置我的 /etc/nginx/sites-available/mydomainname.com 配置文件(当然是我的真实域名),但我无法让它工作。我已经尝试了很多 fastcgi 参数示例,但都没有奏效。 The site I mentioned has also an example 它在 2 年前有效,但现在无效。我得到同样的错误:FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream.
有人可以帮我吗?这个配置有什么问题?
location ~ [^/].php(/|$) {
fastcgi_split_path_info ^(.+?.php)(/.*)$;
fastcgi_pass unix:/var/run/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
【问题讨论】:
-
"Primary script unknown" 表示 SCRIPT_FILENAME 的值不指向 PHP 可以读取的文件。检查您的
fastcgi_params文件,以及由该location继承的root指令的值。 -
非常感谢。我需要输入这条线,现在它可以工作了
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
标签: ubuntu nginx fastcgi owncloud