zoukankan      html  css  js  c++  java
  • [PHP] 安装PHP报错“Primary script unknown”的解决方法

    当安装完最新版的nginx和最新版的PHP以后,使用niginx默认配置文件中的PHP配置会有错误
    访问指定目录下的php文件时,显示File not found.错误。查看nginx的错误日志显示

    90#90: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, server: 127.0.0.1, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1"

    排查的过程:
    1.修改默认PHP配置中的fastcgi_param配置fastcgi_param配置,这个地方默认的是/Scripts$fastcgi_script_name

    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    2.把root指令从location /{}块里面拿到外面,因为看fpm的access日志,访问PHP文件报的404错误

    最简配置如下:

    server {
        listen       80;
        server_name  127.0.0.1;
        access_log  /var/log/nginx/default.access.log  main;
        error_log /var/log/nginx/default.error.log;
        root   /var/www/html;
        location / {
            index  index.html index.htm;
        }
        location ~ .php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    }
  • 相关阅读:
    struts2 局部类型转换器
    Struts2 命名空间配置
    Struts2 国际化
    Struts2 跟踪用户状态
    Struts2
    Struts2支持的处理结果类型
    SGI STL内存配置器(一):内存泄漏?
    TP 3.2 笔记 (1)
    AOP TP框架有感
    eclipse+git
  • 原文地址:https://www.cnblogs.com/taoshihan/p/11602489.html
Copyright © 2011-2022 走看看