PHP-FPM禁止所有连接

时间:2019-09-13 15:51:22

标签: php docker docker-compose fastcgi

我有一个单独的apache容器,应该使用此php-fpm容器。当我尝试访问localhost并使用网站时,错误发生。

我的php fpm日志中的错误:

[13-Sep-2019 15:37:12] WARNING: [pool www] child 21 said into stderr: "ERROR: Connection disallowed: IP address '172.23.0.5' has been dropped."

Dockerfile的重要部分:

FROM amazonlinux:2.0.20190823.1-with-sources
WORKDIR /srv/www

RUN yum -y update

RUN amazon-linux-extras install -y php7.2 epel

COPY php.ini /etc/php.d/zz-docker.ini
# For some reason this doesn't work, so we use this file to append to configs later to get around the issue
COPY php-fpm.conf /etc/php-fpm.d/zz-docker.conf
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["bash"]

entrypoint.sh的重要位:

#!/bin/bash
# For some reason the php fpm config isn't being picked up in the .d directory so we append to the end of the configs
sudo bash -c "cat /etc/php-fpm.d/zz-docker.conf >> /etc/php-fpm.conf"
sudo bash -c "cat /etc/php-fpm.d/zz-docker.conf >> /etc/php-fpm.d/www.conf"

sudo php-fpm --daemonize

bash -c "$@;"

php-fpm.conf文件:

[global]
daemonize = yes
error_log = /srv/www/var/log/php-fpm-error.log

[www]
listen = [::]:9001
chdir = /srv/www
catch_workers_output = Yes

我看不到任何拒绝连接的原因,它应该接受9001端口的任何连接。

apache容器日志中的错误:

[Fri Sep 13 15:37:12.560691 2019] [proxy_fcgi:error] [pid 9:tid 140187870595816] (104)Connection reset by peer: [client 172.23.0.6:41708] AH01074: Failed writing Environment to :

编辑:自从最初的帖子我已经完善了如何添加php-fpm配置,现在我将全局设置更改附加到php-fpm.conf文件,并将www设置附加到php-fpm.d / www.conf文件。这向我突显了添加的www池设置似乎被忽略,但是添加的全局设置很好。

0 个答案:

没有答案