1
Docker画像でphp-fpmを設定しようとしています。php-fpmピアによる接続のリセット
ここに私のドッキングウィンドウ-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"
ドッカーイメージは、このコマンドを使用しています。
CMD php-fpm7.0 --fpm-config /etc/php-fpm.conf
は、ここに私のphp-FPM confのだ:
[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からの接続を受け付けるためにphp-fpmが必要です。 。
私が実行されている画像にログインするdocker exec
を実行し、サーバーをテストするためにwget
を走っ:
[email protected]:/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
問題は、listen.allowed_clients = 127.0.0.1を設定して、どのIPにも接続できるようにすることです。ドキュメントには、空白の場合はすべての接続を受け入れることが示されています。これは、ドッカー環境ではそうではないようです。私はこの行をコメントアウトし、 'listen.allowed_clients ='もどちらも私のために働かなかった。指定したIPへの接続のみが受け入れられます。コンテナが実行されるまではわからないでしょう。 – b01