2021/03/21 06:07:35 [error] 23#23: *5 FastCGI sent in stderr: “Primary script unknown” while reading response header from upstream, client: 10.244.11.0, server: _, request: “GET /123.php HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “10.104.198.121”
报错信息:
2021/03/21 06:07:35 [error] 23#23: *5 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 10.244.11.0, server: _, request: "GET /123.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "10.104.198.121"
解决:
在nginx配置文件中需要定义/root
,然后用$document_root
指定php文件路径
例如:
root /app;
index index.html index.php;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}