【发布时间】:2021-08-03 19:30:22
【问题描述】:
我使用 nginx docker 作为代理服务器,还有其他容器在运行:nuxt.js 和 php-fpm。
这是我的fpm 的conf 文件:
server {
server_name fpm.me.com;
root /var/www/fpm/html;
location / {
# try to serve file directly, fallback to index.php
try_files $uri /index.php$is_args$args;
}
#location ~ ^/index\.php(/|$) {
# https://stackoverflow.com/questions/68350978/nginx-serving-only-but-not-any-other-files
location ~ \.php(/|$) {
fastcgi_pass fpm:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
#internal;
}
location ~ \.php$ {
return 404;
}
access_log off;
error_log /dev/stderr;
}
但是当我输入fpm.me.com 时,我在nginx 的log 文件中收到此错误:
2021/08/03 09:31:18 [error] 31#31: *13 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: MY_IP, server: fpm.me.com, request: "GET / HTTP/1.1", upstream: "fastcgi://172.20.0.8:9000", host: "fpm.me.com"
我在 StackOverFlow、ServerFault 和其他网站上看到了其他答案,但似乎对我没有帮助。
【问题讨论】:
标签: php laravel docker nginx fpm