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;
    }

GitHub 加速计划 / li / linux-dash
10
2
下载
A beautiful web dashboard for Linux
最近提交(Master分支:18 天前 )
186a802e added ecosystem file for PM2 5 年前
5def40a3 Add host customization support for the NodeJS version 5 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐