使用 Nginx 运行 PHP 时找不到文件 [英] File Not Found when running PHP with Nginx

查看:34
本文介绍了使用 Nginx 运行 PHP 时找不到文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Recently I installed the latest version of Nginx and looks like I'm having hard time running PHP with it.

这是我用于域的配置文件:

Here is the configuration file I'm using for the domain:

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

}

这是我在错误日志文件中遇到的错误:

Here is the error I'm getting on the error log file:

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

推荐答案

尝试另一个 *fastcgi_param* 之类的东西

Try another *fastcgi_param* something like

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

这篇关于使用 Nginx 运行 PHP 时找不到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆