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

辣条拌鱼翅 发布于 2016/04/07 13:07
阅读 305
收藏 0

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

    }
 }





加载中
0
mickelfeng
mickelfeng

#fastcgi_pass 127.0.0.1:9000;

#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

这两行注释了哈

1
Eilick
Eilick
chmod 755 你的www-data目录
返回顶部
顶部