【问题标题】:502 Bad Gateway with nginx and php7.0-fpm on dockerdocker 上带有 nginx 和 php7.0-fpm 的 502 Bad Gateway
【发布时间】:2018-09-12 00:44:31
【问题描述】:

我创建了 docker 镜像,其中包括 Debian 软件包 nginx-full, php7.0, php7.0-fpm, php-zmq 和用 PHP 编写的应用程序代码。

当我尝试从浏览器调用应用程序(基本上是调用 zeroMQ)时,我收到 502 bad gateway 错误。如何判断是服务器问题还是代码问题?

尝试更改套接字文件的权限并 无法打印 PATH_INFO 变量。

Nginx 日志

157#157: *622 recv() failed (104: Connection reset by peer) while reading response header from upstream,

PHP-FPM 日志

[02-Apr-2018 16:05:26] WARNING: [pool www] child 197 exited on signal 11 (SIGSEGV) after 79.435089 seconds from start
[02-Apr-2018 16:05:26] NOTICE: [pool www] child 203 started

nginx 配置:

location ~ \.php$ {
                fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
                fastcgi_index index.php;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                fastcgi_param PATH_INFO        $fastcgi_path_info;
                include /etc/nginx/fastcgi_params;
                }

PHP-FPM 配置

user = www-data
group = www-data

//tried  127.0.0.1:900 but did not work
listen = /run/php/php7.0-fpm.sock

收到错误后,当我重新加载php-fpm 时,错误消失了。但之后会再次发生。

【问题讨论】:

  • 欢迎来到 Stack Overflow!我更新了您问题的格式以提高可读性并包含标签 php-7。这有助于了解该主题的用户更轻松地发现问题。您已经将标题格式化为粗体。为了正确渲染标记,意图和额外行的间距很重要。有关格式化的更多信息,请参阅*.com/editing-help。请验证您的问题内容现在看起来是否正确。祝你好运!

标签: nginx php-7


【解决方案1】:

这是一个已知错误,请尝试使用此更新: Dockerfile

【讨论】:

  • 我已经尝试过了,因为项目 /var/run 有一个指向 /run 路径的链接。我认为它会是一样的。
  • 编辑了我的答案
最近更新 更多