nginxFastCGI配置Noinputfilespecified-创新互联

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

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

创新互联专注为客户提供全方位的互联网综合服务,包含不限于网站设计制作、做网站、无锡网络推广、成都小程序开发、无锡网络营销、无锡企业策划、无锡品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们大的嘉奖;创新互联为所有大学生创业者提供无锡建站搭建服务,24小时服务热线:18982081108,官方网址:www.cdcxhl.com

结果提示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;
}

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


新闻标题:nginxFastCGI配置Noinputfilespecified-创新互联
文章链接:http://bzwzjz.com/article/dejhjp.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 成都网站设计公司 成都网站设计公司 成都网站设计 成都网站设计 成都网站建设 达州网站设计 定制网站建设多少钱 重庆网站建设 重庆网站制作 成都网站建设公司 成都网站设计 手机网站制作 品牌网站建设 成都定制网站建设 成都商城网站制作 成都网站设计 高端网站设计推广 成都网站设计 专业网站设计 成都营销网站建设 定制网站制作 重庆外贸网站建设