zoukankan      html  css  js  c++  java
  • nginx FastCGI配置 No input file specified

    配置好nginx,启动nginx,设置按照FastCGI的默认配置,配置好,访问php文件。

    curl -i http://localhost/test.php

    结果提示No input file specified,但是我在/usr/local/nginx/html/目录下的确有test.php文件。我的配置如下:

    location ~ .php$ {
       root html;
      #echo $fastcgi_script_name;
      charset utf8;
      fastcgi_pass 127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
      include fastcgi_params;
     }

    搜了一下,发现还得在fastcgi_param这指定目录,正确的应该是:

    location ~ .php$ {
       root html;
      #echo $fastcgi_script_name;
      charset utf8;
      fastcgi_pass 127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;
     }

    所以就算把php目录配置为其他目录,依然需要在fastcgi_param SCRIPT_FILENAME添加上路径名,可以把$document_root设置为需要设置的目录,或者直接写:

    fastcgi_param SCRIPT_FILENAME /the path$fastcgi_script_name;

    nginx配置文件中FastCGI的默认配置是:

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

    我之前就直接写这个配置结果一直,出错

  • 相关阅读:
    JS中json对象克隆
    jhipster中图片路径打包问题(webpack)
    arcgis for javascript api 4.x 中,使用本地非 4326坐标系绘制功能实现
    spring核心之IOC
    spring基于XML的声明式事务控制
    hibernate之事务处理
    hibernate之一级缓存
    hibernate之一对多,多对一
    hibernate之HQL,Criteria与SQL
    spring的基于注解的IOC配置
  • 原文地址:https://www.cnblogs.com/hahawgp/p/3824134.html
Copyright © 2011-2022 走看看