Skip to content

Commit 2364244

Browse files
authored
Configuring PHP FPM (#114)
1 parent 9e5c637 commit 2364244

File tree

2 files changed

+64
-1
lines changed

2 files changed

+64
-1
lines changed

Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ RUN mkdir -p /var/log/php; \
8989

9090
# Copying PHP conf file
9191
COPY php/php.ini /usr/local/etc/php/php.ini
92+
COPY php/fpm-pool.conf /usr/local/etc/php/php-fpm.d/www.conf
9293

9394
WORKDIR /app/bimbalacom
9495

@@ -112,4 +113,4 @@ ENV EDITOR=nano
112113

113114
CMD supervisord -c /etc/supervisor.d/supervisord.ini & \
114115
crond && \
115-
php-fpm -F -R
116+
php-fpm -F -R

php/fpm-pool.conf

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
[global]
2+
; Log to stderr
3+
error_log = /dev/stderr
4+
5+
[www]
6+
; The address on which to accept FastCGI requests.
7+
; Valid syntaxes are:
8+
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
9+
; a specific port;
10+
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
11+
; a specific port;
12+
; 'port' - to listen on a TCP socket to all addresses
13+
; (IPv6 and IPv4-mapped) on a specific port;
14+
; '/path/to/unix/socket' - to listen on a unix socket.
15+
; Note: This value is mandatory.
16+
listen = 127.0.0.1:9000
17+
18+
; Enable status page
19+
pm.status_path = /fpm-status
20+
21+
; Ondemand process manager
22+
pm = dynamic
23+
24+
; The number of child processes to be created when pm is set to 'static' and the
25+
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
26+
; This value sets the limit on the number of simultaneous requests that will be
27+
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
28+
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
29+
; CGI. The below defaults are based on a server without much resources. Don't
30+
; forget to tweak pm.* to fit your needs.
31+
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
32+
; Note: This value is mandatory.
33+
pm.start_servers = 10
34+
35+
pm.min_spare_servers = 5
36+
37+
pm.max_spare_servers = 20
38+
39+
pm.max_children = 100
40+
41+
; The number of seconds after which an idle process will be killed.
42+
; Note: Used only when pm is set to 'ondemand'
43+
; Default Value: 10s
44+
pm.process_idle_timeout = 10s;
45+
46+
; The number of requests each child process should execute before respawning.
47+
; This can be useful to work around memory leaks in 3rd party libraries. For
48+
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
49+
; Default Value: 0
50+
pm.max_requests = 1000
51+
52+
; Make sure the FPM workers can reach the environment variables for configuration
53+
clear_env = no
54+
55+
; Catch output from PHP
56+
catch_workers_output = yes
57+
58+
; Remove the 'child 10 said into stderr' prefix in the log and only show the actual message
59+
decorate_workers_output = no
60+
61+
; Enable ping page to use in healthcheck
62+
ping.path = /fpm-ping

0 commit comments

Comments
 (0)