Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
对等端重置php fpm连接_Php_Docker_Fpm - Fatal编程技术网

对等端重置php fpm连接

对等端重置php fpm连接,php,docker,fpm,Php,Docker,Fpm,我正在尝试在Docker映像上设置php fpm 以下是my docker-compose.yml中的服务: wordpress-service: build: context: . dockerfile: Dockerfile-wordpress image: riffsy-web-wordpress:latest restart: always links: - wordpress-mysql depends_on: - wordpress-m

我正在尝试在Docker映像上设置php fpm

以下是my docker-compose.yml中的服务:

wordpress-service:
  build:
    context: .
    dockerfile: Dockerfile-wordpress
  image: riffsy-web-wordpress:latest
  restart: always
  links:
   - wordpress-mysql
  depends_on:
   - wordpress-mysql
  expose:
    - "8000"
  environment:
   - DB_NAME=wordpress
   - DB_USER=wordpress
   - DB_PASSWORD=password123
   - DB_HOST=wordpress-mysql
   - DB_PORT=3306
  ports:
   - "8000:8000"
Docker image使用以下命令:

CMD php-fpm7.0 --fpm-config /etc/php-fpm.conf
以下是我的php fpm配置:

[global]

error_log = /dev/stderr
log_level = debug
daemonize = no

[www]
listen = 8000
listen.allowed_clients = 127.0.0.1
user = www-data
group = www-data
pm = dynamic
pm.max_children = 6
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 4
pm.max_requests = 500
request_terminate_timeout = 120s
catch_workers_output = yes
我设置了
listen.allowed_clients=127.0.0.1
,因为否则我会收到连接被拒绝的消息;最终,我需要php fpm来接受来自任何IP的连接,因为我不知道我的Nginx映像将具有什么IP,而且这并不重要,因为我的php fpm映像不会公开连接到internet

我运行了
docker exec
登录到正在运行的映像,并运行了
wget
来测试服务器:

root@428d78fd58df:/srv# wget 127.0.0.1:8000                           
--2016-09-12 07:55:13--  http://127.0.0.1:8000/
Connecting to 127.0.0.1:8000... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

--2016-09-12 07:55:14--  (try: 2)  http://127.0.0.1:8000/
Connecting to 127.0.0.1:8000... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

--2016-09-12 07:55:16--  (try: 3)  http://127.0.0.1:8000/
Connecting to 127.0.0.1:8000... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

^C
控制台仅显示以下输出:

wordpress-service_1  | [12-Sep-2016 08:01:09.757039] DEBUG: pid 5, fpm_pctl_perform_idle_server_maintenance(), line 379: [pool www] currently 0 active children, 2 spare children, 2 running children. Spawning rate 1

问题是php fpm不使用http协议,而是使用fastcgi。连接它的唯一方法是将Nginx设置为使用fastcgi。

问题是需要设置
listen.allowed\u clients=127.0.0.1
,以允许任何IP连接到它。文档中说,如果它为空,那么它将接受所有连接。在docker环境中,情况似乎并非如此。我试着对这一行进行注释并设置
listen.allowed\u clients=
对我来说都不起作用。它将只接受到您指定的IP的连接。在容器运行之前,您不会知道这一点。