环境是ubuntu nginx php mysql
如果是正常访问PHP输出是正常的 http://localhost/test/index.php 正常输出
如果是我配置了虚拟主机PHP文件就无法正常输出了 http://www.test.com/index.php 页面就会提示 " no input file specified."
nginx log
2016/04/07 11:33:54 [error] 22384#0: *27 FastCGI sent in stderr: "Unable to open primary script: /www/test/index.php (No such file or directory)" while reading response header from upstream, client: 127.0.0.1, server: www.test.com, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "www.test.com"
nginx vhosts
 
 
 server {
        listen   80; ## listen for ipv4; this line is default and implied
       #listen   [::]:80 default ipv6only=on; ## listen for ipv6
 
          root /www/test/; #你网站所在目录的绝对路径
           index index.php index.html index.htm; #目录索引
 
          # Make site accessible from http://localhost/
              server_name  www.test.com; #网站的域名
 
       location / {
                  index index.html index.htm index.php;  #目录索引
                  rewrite ^/(.*)$ /index.php/$1 last;  #Rewrite 隐藏index.php
        }
 
  #使nginx支持php
      location ~ ^(.+\.php)(.*)$ {
         #fastcgi_pass 127.0.0.1:9000;
         fastcgi_pass unix:/var/run/php5-fpm.sock;
         fastcgi_index index.php;
         fastcgi_split_path_info ^(.+\.php)(.*)$;
         #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include fastcgi_params;
 
     }
  } 
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
"
 <span style=""font-family:Verdana, sans-serif, 宋体;font-size:14px;line-height:22px;background-color:#FFFFFF;""><span style=""font-family:Verdana, sans-serif, 宋体;font-size:14px;line-height:22px;background-color:#FFFFFF;"">#fastcgi_pass 127.0.0.1:9000;
  
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
这两行注释了哈
######chmod 755 你的www-data目录"