Rumah > pembangunan bahagian belakang > tutorial php > nginx - php file not found

nginx - php file not found

WBOY
Lepaskan: 2016-06-06 20:42:51
asal
2375 orang telah melayarinya

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

<code>Vagrant 1.6.5
</code>
Salin selepas log masuk
Salin selepas log masuk

目录权限是

<code>drwxr-xr-x 1 vagrant vagrant
</code>
Salin selepas log masuk
Salin selepas log masuk

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>
Salin selepas log masuk
Salin selepas log masuk

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>
Salin selepas log masuk
Salin selepas log masuk

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

回复内容:

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

<code>Vagrant 1.6.5
</code>
Salin selepas log masuk
Salin selepas log masuk

目录权限是

<code>drwxr-xr-x 1 vagrant vagrant
</code>
Salin selepas log masuk
Salin selepas log masuk

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>
Salin selepas log masuk
Salin selepas log masuk

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>
Salin selepas log masuk
Salin selepas log masuk

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

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan