最近我安装了最新版本的Nginx,看起来很难用它运行PHP.

以下是我用于域的配置文件:

server {
listen       80;
server_name  localhost;

location / {
    root   /usr/share/nginx/html;
    index  index.php;
}

error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   /usr/share/nginx/html;
}

location ~ \.php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    include        fastcgi_params;
}

}

下面是我在错误日志(log)文件中看到的错误:

FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream

推荐答案

试试另一个*fastcgi_param*类似的东西

fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;

Php相关问答推荐

shell_exec()在后台执行nohup时不会立即返回

PHP和可选函数参数

为什么这个方法调用用引号和花括号包裹?

wp_enqueue_scripts not loading(基于类的插件)

PHP-转义字符串内的双反斜杠

Php解压缩deflate64

Filament v3:具有 hasMany 和 BelongsTo 的关系管理器

显示 woocommerce 中所选变体的属性术语描述

从 XAMPP 运行 shell 脚本时,意外标记(附近出现语法错误

使用 wp_footer 挂钩添加一些 CSS 不起作用

使用产品自定义字段作为 WooCommerce 中特定用户角色的折扣百分比

simplexml_load_file 和 simplexml_load_string 返回具有不同编码的相同数据

Laravel Eloquent(where 子句)

根据WooCommerce中的产品重量更改简单产品的输入数量步值

使用来自 PHP 表单的数据更新 xml 命名空间

如何在供应商名称后将自定义徽章添加到商品详情

如何在 WooCommerce 中显示每个自定义选项卡的内容

在 laravel 中更新表单时如何在 Select 选项中保留旧值?

即使密码匹配,密码处理程序也会返回错误

Symfony 在将它传递给 Twig 时是否从数据库中获取整个对象?