nginx:*21 FastCGI sent in stderr: "Primary script unknown"

linux 下php-fpm+nginx 浏览器访问php页面,报file not found

后台nginx 报错:*21 FastCGI sent in stderr: "Primary script unknown"


可能的原因是:

location ~ ^/.*\.php$

这段中,用alias代替了root

修改前:

    location ~ ^/.*\.php$ {
        alias /usr/share/nginx/xxxxxx;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

修改后:

    location ~ ^/.*\.php$ {
        root /usr/share/nginx/;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

你可能感兴趣的:(nginx,php)