开发者社区> 问答> 正文

ubuntu nginx+php 配置虚拟主机出现 no input file specifie

环境是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;

    }
 }

展开
收起
huc_逆天 2020-05-28 09:15:57 804 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
阿里云栖开发者沙龙PHP技术专场-直面PHP微服务架构挑战-高驰涛 立即下载
PHP安全开发:从白帽角度做安全 立即下载
PHP 2017.北京 全球开发者大会——高可用的PHP 立即下载