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;
}
我之前就直接写这个配置结果一直,出错
本文题目:nginxFastCGI配置Noinputfilespecified-创新互联
网页网址:https://www.cdcxhl.com/article28/dejhjp.html
成都网站建设公司_创新互联,为您提供品牌网站设计、品牌网站建设、电子商务、网站制作、网站建设、移动网站建设
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联