nginx+php出现Noinputfilespecified解决办法-创新互联
今天在自己本地的开发环境突然出现了No input file specified错误,反复检查返现自己的配置文件和配置路径以及权限都没有问题。经过反复的排查终于发现了问题,现将问题及解决分享如下:

问题原因分析
在GitHub上下载了一个开源的tp5项目,之前自己本地的网站运行都没有问题。但是安装了这个开源项目后就发现本地其他网站都无法访问了。访问就是No input file specified错误。在网上也找了解决办法,但是都不是,看来这个错误有点儿诡异。
后来反复尝试,重启电脑后问题得到解决但是再次运行下载的tp5开源项目后其他网站又出现了这样的错误No input file specified 而且只有这一个网站运行没有问题。
据此将错误圈定在该开源项目的nginx配置文件中。再来看看该配置文件:
server {
listen 80;
server_name local.test.com;
access_log /data/wwwlogs/local.test.com.log combined;
error_log /data/wwwlogs/local.test.com_error.log error;
index index.html index.htm index.php;
root /data/php/test;
add_header X-Powered-Host $hostname;
fastcgi_hide_header X-Powered-By;
if (!-e $request_filename) {
rewrite ^/(.+?\.php)/?(.*)$ /$1/$2 last;
rewrite ^/(.*)$ /index.php/$1 last;
}
location ~ \.php($|/){
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
set $real_script_name $fastcgi_script_name;
if ($real_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
}
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param PHP_VALUE open_basedir=$document_root:/tmp/:/proc/;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
access_log off;
error_log off;
expires 30d;
}
location ~ .*\.(js|css)?$ {
access_log off;
error_log off;
expires 12h;
}
文章标题:nginx+php出现Noinputfilespecified解决办法-创新互联
文章链接:http://www.jxjierui.cn/article/cceejp.html


咨询
建站咨询
