博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
nginx FastCGI配置 No input file specified
阅读量:4589 次
发布时间:2019-06-09

本文共 1079 字,大约阅读时间需要 3 分钟。

配置好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;
}

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

转载于:https://www.cnblogs.com/hahawgp/p/3824134.html

你可能感兴趣的文章
洛谷 P1439 【模板】最长公共子序列(DP,LIS?)
查看>>
python timeit
查看>>
Wireless Network 并查集
查看>>
51nod 1019 逆序数
查看>>
ubuntu 16 64位编译安装php
查看>>
Building LinkedIn’s Real-time Activity Data Pipeline
查看>>
数据库设计
查看>>
ubuntu 禁用快捷键ALT显示 HUD
查看>>
Spring4 mvc+maven 框架搭建(2)
查看>>
HDU 1574 RP问题
查看>>
UVa 1025 (动态规划) A Spy in the Metro
查看>>
每日python (8)
查看>>
oracle根据正则表达式查找对应的字段
查看>>
Axiom3D写游戏:第一个窗口
查看>>
win10初期版本administrator的限制
查看>>
最近的进展
查看>>
fiddler安装和使用
查看>>
WebViewJavascriptBridge
查看>>
(document).height()与$(window).height()
查看>>
架构之美01
查看>>