开发者社区> 问答> 正文

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 807 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
PHP在机器学习上的应用及云深度学习平台的架构设计与实现 立即下载
CentOS Nginx PHP JAVA 多语言镜像使用手 立即下载
CentOS Nginx PHP JAVA多语言镜像使用手册 立即下载