PHP-FPM | Docker
イメージ
- Docker Hub: https://hub.docker.com/_/php
- GitHub: https://github.com/docker-library/php/tree/master
- ベースイメージ:
php:8.1-fpm-bullseye- php:8.1-fpmのOSもDebian GNU/Linux 11 (bullseye)だが、明示的にbullseysを明示するのが良い
- ベースイメージ GitHub:https://github.com/docker-library/php/tree/master/8.1/bullseye/fpm
- ベースイメージOS:Debian GNU/Linux 11 (bullseye)
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
設定
公式ドキュメントに設定項目が記載されている。
FPM では、php.ini 形式の構文の設定ファイル php-fpm.conf と、プール設定ファイルを使います。
上記にあるように設定は大きく以下に分かれる。
| 項目 | 公式イメージの配置場所 |
|---|---|
| php-fpm.confに記載するグローバル項目 | /usr/local/etc/php-fpm.conf |
| プール設ファイルに記載する項目 | /usr/local/etc/php-fpm.d/www.conf(慣例としてwwwだが、拡張子がconfならば良い) |
Dockerの公式イメージでは/usr/local/etc/php-fpm.confだが、明示されている文献は見つからなかった。
/usr/local/etc/php-fpm.confの末尾に以下の記載がある。なのでプール設定ファイルは/usr/local/etc/php-fpm.d/に拡張子confのファイルを作成する。慣例としてwww.confにする。
;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ;
;;;;;;;;;;;;;;;;;;;;
; Multiple pools of child processes may be started with different listening
; ports and different management options. The name of the pool will be
; used in logs and stats. There is no limitation on the number of pools which
; FPM can handle. Your system will tell you anyway :)
; Include one or more files. If glob(3) exists, it is used to include a bunch of
; files from a glob(3) pattern. This directive can be used everywhere in the
; file.
; Relative path can also be used. They will be prefixed by:
; - the global prefix if it's been set (-p argument)
; - /usr/local otherwise
include=etc/php-fpm.d/*.conf <==== www.confとするのが慣例
現在の設定を確認
$ php-fpm -tt
参照
- https://serverfault.com/questions/884256/how-and-where-to-configure-pm-max-children-for-php-fpm-with-docker