zoukankan      html  css  js  c++  java
  • CentOS 7 + Nginx 1.6.2 + PHP 5.4.45 FastCGI错误Primary script unknown网页显示File not found的解决办法

    话接上文,主系统Windows 10, VirtualBox虚拟机安装CentOS 7, LNMP环境: Nginx 1.6.2 + PHP 5.4.45

    打开index.html没问题显示良好:

    但是我在html下面放了info.php的测试页,却显示File not found. 看了日志/var/log/nginx/error.log才发现写了这么一段:

    [error] 5349#0: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: xx.xx.xx.xx, server: localhost, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "oo.oo.oo.oo:oooo"

    意思就是找不到fastcgi的解析脚本. 这时我就懵了,我分明已经修改了nginx的配置文件啊,指定了.php的解析路径,怎么会发生这么个错误.

    后来发现我修改的是/etc/nginx/conf.d/default.conf,这在以前的版本中是可以的,但是当前的Nginx版本好像是改了,应该修改的是/etc/nginx/nginx.conf这个配置文件,修改如下图所示的部分

    最关键的是下面的命令:

    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    

    其中$document_root就是php文件的root目录.

    下来就是重启nginx服务,刷新网页就出现了本该出现的画面:

  • 相关阅读:
    【C++日常】C++动态命名变量名
    两个整数相除
    Jsp页面跳转 接收时的乱码问题
    Reverse a singly linked list
    Java处理excel文件
    Navicat for mysql 破解
    EasyUi 分页 和 表格数据加载
    Spring 框架下Controller 返回结果在EasyUI显示
    svn ubuntu command(转载)
    Shiro Security
  • 原文地址:https://www.cnblogs.com/make217/p/5836864.html
Copyright © 2011-2022 走看看