【Docker】FastCGI sent in stderr: "Primary script unknown" while reading

多容器搭建 php-fpm + nginx, 在测试 nginx 的配置是否成功与 fpm 连通时,访问 url,

每次都报 File not found.

nginx 的日志如下:

【Docker】FastCGI sent in stderr:

核心的问题: FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream

docker logs php-fpm 的日志如下:

【Docker】FastCGI sent in stderr:

nginx 的日志如下:

server {

listen 80;

server_name localhost;

root /usr/share/nginx/html/;

index index.php index.html index.htm;

location / {

try_files $uri $uri/ =404;

}

location ~ \.php$ {

fastcgi_pass php_180227_7.1.0:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

}

location ~ /\.ht {

deny all;

}

}

nginx 的共享目录如下(/home/docker_lnmp/nginx/www:/usr/share/nginx/html):

【Docker】FastCGI sent in stderr:

php 的共享目录如下(/home/docker_lnmp/nginx/www:/var/www/html):

【Docker】FastCGI sent in stderr:

回答

nginx 配置文件 config

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

要换成

fastcgi_param  SCRIPT_FILENAME  /var/www/html$fastcgi_script_name;

不然 php fastcgi解析不了目录

牛,真的解决了。

以上是 【Docker】FastCGI sent in stderr: "Primary script unknown" while reading 的全部内容, 来源链接: utcz.com/a/76407.html

回到顶部