首页 > 后端开发 > php教程 > nginx - php file not found

nginx - php file not found

WBOY
发布: 2016-06-06 20:42:51
原创
2379 人浏览过

用vagrant 配置了环境,但是死活都是‘file not found’
vagrant版本

<code>Vagrant 1.6.5
</code>
登录后复制
登录后复制

目录权限是

<code>drwxr-xr-x 1 vagrant vagrant
</code>
登录后复制
登录后复制

nginx 报错信息

<code>[error] 2186#0: *32 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.33.1, server: xxx.xxx.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:"
</code>
登录后复制
登录后复制

nginx配置

<code>    server {
        listen   80; ## listen for ipv4; this line is default and implied

        server_name xxx.xxx.com;
        root /vagrant/demo;
        index index.php;

        # Make site accessible from http://localhost/

        if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php$1 last;
        }

        location ~ [^/]\.php(/|$) {
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include fastcgi_params;

        }
}
</code>
登录后复制
登录后复制

网上的都试过了,还是不行。

回复内容:

用vagrant 配置了环境,但是死活都是‘file not found’
vagrant版本

<code>Vagrant 1.6.5
</code>
登录后复制
登录后复制

目录权限是

<code>drwxr-xr-x 1 vagrant vagrant
</code>
登录后复制
登录后复制

nginx 报错信息

<code>[error] 2186#0: *32 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.33.1, server: xxx.xxx.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:"
</code>
登录后复制
登录后复制

nginx配置

<code>    server {
        listen   80; ## listen for ipv4; this line is default and implied

        server_name xxx.xxx.com;
        root /vagrant/demo;
        index index.php;

        # Make site accessible from http://localhost/

        if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php$1 last;
        }

        location ~ [^/]\.php(/|$) {
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include fastcgi_params;

        }
}
</code>
登录后复制
登录后复制

网上的都试过了,还是不行。

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板