xref: /PHP-8.1/sapi/fpm/www.conf.in (revision 7d98e3e4)
1; Start a new pool named 'www'.
2; the variable $pool can be used in any directive and will be replaced by the
3; pool name ('www' here)
4[www]
5
6; Per pool prefix
7; It only applies on the following directives:
8; - 'access.log'
9; - 'slowlog'
10; - 'listen' (unixsocket)
11; - 'chroot'
12; - 'chdir'
13; - 'php_values'
14; - 'php_admin_values'
15; When not set, the global prefix (or @php_fpm_prefix@) applies instead.
16; Note: This directive can also be relative to the global prefix.
17; Default Value: none
18;prefix = /path/to/pools/$pool
19
20; Unix user/group of the child processes. This can be used only if the master
21; process running user is root. It is set after the child process is created.
22; The user and group can be specified either by their name or by their numeric
23; IDs.
24; Note: If the user is root, the executable needs to be started with
25;       --allow-to-run-as-root option to work.
26; Default Values: The user is set to master process running user by default.
27;                 If the group is not set, the user's group is used.
28user = @php_fpm_user@
29group = @php_fpm_group@
30
31; The address on which to accept FastCGI requests.
32; Valid syntaxes are:
33;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific IPv4 address on
34;                            a specific port;
35;   '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
36;                            a specific port;
37;   'port'                 - to listen on a TCP socket to all addresses
38;                            (IPv6 and IPv4-mapped) on a specific port;
39;   '/path/to/unix/socket' - to listen on a unix socket.
40; Note: This value is mandatory.
41listen = 127.0.0.1:9000
42
43; Set listen(2) backlog.
44; Default Value: 511 (-1 on FreeBSD and OpenBSD)
45;listen.backlog = 511
46
47; Set permissions for unix socket, if one is used. In Linux, read/write
48; permissions must be set in order to allow connections from a web server. Many
49; BSD-derived systems allow connections regardless of permissions. The owner
50; and group can be specified either by name or by their numeric IDs.
51; Default Values: Owner is set to the master process running user. If the group
52;                 is not set, the owner's group is used. Mode is set to 0660.
53;listen.owner = @php_fpm_user@
54;listen.group = @php_fpm_group@
55;listen.mode = 0660
56
57; When POSIX Access Control Lists are supported you can set them using
58; these options, value is a comma separated list of user/group names.
59; When set, listen.owner and listen.group are ignored
60;listen.acl_users =
61;listen.acl_groups =
62
63; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
64; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
65; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
66; must be separated by a comma. If this value is left blank, connections will be
67; accepted from any ip address.
68; Default Value: any
69;listen.allowed_clients = 127.0.0.1
70
71; Specify the nice(2) priority to apply to the pool processes (only if set)
72; The value can vary from -19 (highest priority) to 20 (lower priority)
73; Note: - It will only work if the FPM master process is launched as root
74;       - The pool processes will inherit the master process priority
75;         unless it specified otherwise
76; Default Value: no set
77; process.priority = -19
78
79; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user
80; or group is different than the master process user. It allows to create process
81; core dump and ptrace the process for the pool user.
82; Default Value: no
83; process.dumpable = yes
84
85; Choose how the process manager will control the number of child processes.
86; Possible Values:
87;   static  - a fixed number (pm.max_children) of child processes;
88;   dynamic - the number of child processes are set dynamically based on the
89;             following directives. With this process management, there will be
90;             always at least 1 children.
91;             pm.max_children      - the maximum number of children that can
92;                                    be alive at the same time.
93;             pm.start_servers     - the number of children created on startup.
94;             pm.min_spare_servers - the minimum number of children in 'idle'
95;                                    state (waiting to process). If the number
96;                                    of 'idle' processes is less than this
97;                                    number then some children will be created.
98;             pm.max_spare_servers - the maximum number of children in 'idle'
99;                                    state (waiting to process). If the number
100;                                    of 'idle' processes is greater than this
101;                                    number then some children will be killed.
102;             pm.max_spawn_rate    - the maximum number of rate to spawn child
103;                                    processes at once.
104;  ondemand - no children are created at startup. Children will be forked when
105;             new requests will connect. The following parameter are used:
106;             pm.max_children           - the maximum number of children that
107;                                         can be alive at the same time.
108;             pm.process_idle_timeout   - The number of seconds after which
109;                                         an idle process will be killed.
110; Note: This value is mandatory.
111pm = dynamic
112
113; The number of child processes to be created when pm is set to 'static' and the
114; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
115; This value sets the limit on the number of simultaneous requests that will be
116; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
117; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
118; CGI. The below defaults are based on a server without much resources. Don't
119; forget to tweak pm.* to fit your needs.
120; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
121; Note: This value is mandatory.
122pm.max_children = 5
123
124; The number of child processes created on startup.
125; Note: Used only when pm is set to 'dynamic'
126; Default Value: (min_spare_servers + max_spare_servers) / 2
127pm.start_servers = 2
128
129; The desired minimum number of idle server processes.
130; Note: Used only when pm is set to 'dynamic'
131; Note: Mandatory when pm is set to 'dynamic'
132pm.min_spare_servers = 1
133
134; The desired maximum number of idle server processes.
135; Note: Used only when pm is set to 'dynamic'
136; Note: Mandatory when pm is set to 'dynamic'
137pm.max_spare_servers = 3
138
139; The number of rate to spawn child processes at once.
140; Note: Used only when pm is set to 'dynamic'
141; Note: Mandatory when pm is set to 'dynamic'
142; Default Value: 32
143;pm.max_spawn_rate = 32
144
145; The number of seconds after which an idle process will be killed.
146; Note: Used only when pm is set to 'ondemand'
147; Default Value: 10s
148;pm.process_idle_timeout = 10s;
149
150; The number of requests each child process should execute before respawning.
151; This can be useful to work around memory leaks in 3rd party libraries. For
152; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
153; Default Value: 0
154;pm.max_requests = 500
155
156; The URI to view the FPM status page. If this value is not set, no URI will be
157; recognized as a status page. It shows the following information:
158;   pool                 - the name of the pool;
159;   process manager      - static, dynamic or ondemand;
160;   start time           - the date and time FPM has started;
161;   start since          - number of seconds since FPM has started;
162;   accepted conn        - the number of request accepted by the pool;
163;   listen queue         - the number of request in the queue of pending
164;                          connections (see backlog in listen(2));
165;   max listen queue     - the maximum number of requests in the queue
166;                          of pending connections since FPM has started;
167;   listen queue len     - the size of the socket queue of pending connections;
168;   idle processes       - the number of idle processes;
169;   active processes     - the number of active processes;
170;   total processes      - the number of idle + active processes;
171;   max active processes - the maximum number of active processes since FPM
172;                          has started;
173;   max children reached - number of times, the process limit has been reached,
174;                          when pm tries to start more children (works only for
175;                          pm 'dynamic' and 'ondemand');
176; Value are updated in real time.
177; Example output:
178;   pool:                 www
179;   process manager:      static
180;   start time:           01/Jul/2011:17:53:49 +0200
181;   start since:          62636
182;   accepted conn:        190460
183;   listen queue:         0
184;   max listen queue:     1
185;   listen queue len:     42
186;   idle processes:       4
187;   active processes:     11
188;   total processes:      15
189;   max active processes: 12
190;   max children reached: 0
191;
192; By default the status page output is formatted as text/plain. Passing either
193; 'html', 'xml' or 'json' in the query string will return the corresponding
194; output syntax. Example:
195;   http://www.foo.bar/status
196;   http://www.foo.bar/status?json
197;   http://www.foo.bar/status?html
198;   http://www.foo.bar/status?xml
199;
200; By default the status page only outputs short status. Passing 'full' in the
201; query string will also return status for each pool process.
202; Example:
203;   http://www.foo.bar/status?full
204;   http://www.foo.bar/status?json&full
205;   http://www.foo.bar/status?html&full
206;   http://www.foo.bar/status?xml&full
207; The Full status returns for each process:
208;   pid                  - the PID of the process;
209;   state                - the state of the process (Idle, Running, ...);
210;   start time           - the date and time the process has started;
211;   start since          - the number of seconds since the process has started;
212;   requests             - the number of requests the process has served;
213;   request duration     - the duration in µs of the requests;
214;   request method       - the request method (GET, POST, ...);
215;   request URI          - the request URI with the query string;
216;   content length       - the content length of the request (only with POST);
217;   user                 - the user (PHP_AUTH_USER) (or '-' if not set);
218;   script               - the main script called (or '-' if not set);
219;   last request cpu     - the %cpu the last request consumed
220;                          it's always 0 if the process is not in Idle state
221;                          because CPU calculation is done when the request
222;                          processing has terminated;
223;   last request memory  - the max amount of memory the last request consumed
224;                          it's always 0 if the process is not in Idle state
225;                          because memory calculation is done when the request
226;                          processing has terminated;
227; If the process is in Idle state, then informations are related to the
228; last request the process has served. Otherwise informations are related to
229; the current request being served.
230; Example output:
231;   ************************
232;   pid:                  31330
233;   state:                Running
234;   start time:           01/Jul/2011:17:53:49 +0200
235;   start since:          63087
236;   requests:             12808
237;   request duration:     1250261
238;   request method:       GET
239;   request URI:          /test_mem.php?N=10000
240;   content length:       0
241;   user:                 -
242;   script:               /home/fat/web/docs/php/test_mem.php
243;   last request cpu:     0.00
244;   last request memory:  0
245;
246; Note: There is a real-time FPM status monitoring sample web page available
247;       It's available in: @EXPANDED_DATADIR@/fpm/status.html
248;
249; Note: The value must start with a leading slash (/). The value can be
250;       anything, but it may not be a good idea to use the .php extension or it
251;       may conflict with a real PHP file.
252; Default Value: not set
253;pm.status_path = /status
254
255; The address on which to accept FastCGI status request. This creates a new
256; invisible pool that can handle requests independently. This is useful
257; if the main pool is busy with long running requests because it is still possible
258; to get the status before finishing the long running requests.
259;
260; Valid syntaxes are:
261;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific IPv4 address on
262;                            a specific port;
263;   '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
264;                            a specific port;
265;   'port'                 - to listen on a TCP socket to all addresses
266;                            (IPv6 and IPv4-mapped) on a specific port;
267;   '/path/to/unix/socket' - to listen on a unix socket.
268; Default Value: value of the listen option
269;pm.status_listen = 127.0.0.1:9001
270
271; The ping URI to call the monitoring page of FPM. If this value is not set, no
272; URI will be recognized as a ping page. This could be used to test from outside
273; that FPM is alive and responding, or to
274; - create a graph of FPM availability (rrd or such);
275; - remove a server from a group if it is not responding (load balancing);
276; - trigger alerts for the operating team (24/7).
277; Note: The value must start with a leading slash (/). The value can be
278;       anything, but it may not be a good idea to use the .php extension or it
279;       may conflict with a real PHP file.
280; Default Value: not set
281;ping.path = /ping
282
283; This directive may be used to customize the response of a ping request. The
284; response is formatted as text/plain with a 200 response code.
285; Default Value: pong
286;ping.response = pong
287
288; The access log file
289; Default: not set
290;access.log = log/$pool.access.log
291
292; The access log format.
293; The following syntax is allowed
294;  %%: the '%' character
295;  %C: %CPU used by the request
296;      it can accept the following format:
297;      - %{user}C for user CPU only
298;      - %{system}C for system CPU only
299;      - %{total}C  for user + system CPU (default)
300;  %d: time taken to serve the request
301;      it can accept the following format:
302;      - %{seconds}d (default)
303;      - %{milliseconds}d
304;      - %{milli}d
305;      - %{microseconds}d
306;      - %{micro}d
307;  %e: an environment variable (same as $_ENV or $_SERVER)
308;      it must be associated with embraces to specify the name of the env
309;      variable. Some examples:
310;      - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
311;      - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
312;  %f: script filename
313;  %l: content-length of the request (for POST request only)
314;  %m: request method
315;  %M: peak of memory allocated by PHP
316;      it can accept the following format:
317;      - %{bytes}M (default)
318;      - %{kilobytes}M
319;      - %{kilo}M
320;      - %{megabytes}M
321;      - %{mega}M
322;  %n: pool name
323;  %o: output header
324;      it must be associated with embraces to specify the name of the header:
325;      - %{Content-Type}o
326;      - %{X-Powered-By}o
327;      - %{Transfert-Encoding}o
328;      - ....
329;  %p: PID of the child that serviced the request
330;  %P: PID of the parent of the child that serviced the request
331;  %q: the query string
332;  %Q: the '?' character if query string exists
333;  %r: the request URI (without the query string, see %q and %Q)
334;  %R: remote IP address
335;  %s: status (response code)
336;  %t: server time the request was received
337;      it can accept a strftime(3) format:
338;      %d/%b/%Y:%H:%M:%S %z (default)
339;      The strftime(3) format must be encapsulated in a %{<strftime_format>}t tag
340;      e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
341;  %T: time the log has been written (the request has finished)
342;      it can accept a strftime(3) format:
343;      %d/%b/%Y:%H:%M:%S %z (default)
344;      The strftime(3) format must be encapsulated in a %{<strftime_format>}t tag
345;      e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
346;  %u: remote user
347;
348; Default: "%R - %u %t \"%m %r\" %s"
349;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{milli}d %{kilo}M %C%%"
350
351; The log file for slow requests
352; Default Value: not set
353; Note: slowlog is mandatory if request_slowlog_timeout is set
354;slowlog = log/$pool.log.slow
355
356; The timeout for serving a single request after which a PHP backtrace will be
357; dumped to the 'slowlog' file. A value of '0s' means 'off'.
358; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
359; Default Value: 0
360;request_slowlog_timeout = 0
361
362; Depth of slow log stack trace.
363; Default Value: 20
364;request_slowlog_trace_depth = 20
365
366; The timeout for serving a single request after which the worker process will
367; be killed. This option should be used when the 'max_execution_time' ini option
368; does not stop script execution for some reason. A value of '0' means 'off'.
369; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
370; Default Value: 0
371;request_terminate_timeout = 0
372
373; The timeout set by 'request_terminate_timeout' ini option is not engaged after
374; application calls 'fastcgi_finish_request' or when application has finished and
375; shutdown functions are being called (registered via register_shutdown_function).
376; This option will enable timeout limit to be applied unconditionally
377; even in such cases.
378; Default Value: no
379;request_terminate_timeout_track_finished = no
380
381; Set open file descriptor rlimit.
382; Default Value: system defined value
383;rlimit_files = 1024
384
385; Set max core size rlimit.
386; Possible Values: 'unlimited' or an integer greater or equal to 0
387; Default Value: system defined value
388;rlimit_core = 0
389
390; Chroot to this directory at the start. This value must be defined as an
391; absolute path. When this value is not set, chroot is not used.
392; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
393; of its subdirectories. If the pool prefix is not set, the global prefix
394; will be used instead.
395; Note: chrooting is a great security feature and should be used whenever
396;       possible. However, all PHP paths will be relative to the chroot
397;       (error_log, sessions.save_path, ...).
398; Default Value: not set
399;chroot =
400
401; Chdir to this directory at the start.
402; Note: relative path can be used.
403; Default Value: current directory or / when chroot
404;chdir = /var/www
405
406; Redirect worker stdout and stderr into main error log. If not set, stdout and
407; stderr will be redirected to /dev/null according to FastCGI specs.
408; Note: on highloaded environment, this can cause some delay in the page
409; process time (several ms).
410; Default Value: no
411;catch_workers_output = yes
412
413; Decorate worker output with prefix and suffix containing information about
414; the child that writes to the log and if stdout or stderr is used as well as
415; log level and time. This options is used only if catch_workers_output is yes.
416; Settings to "no" will output data as written to the stdout or stderr.
417; Default value: yes
418;decorate_workers_output = no
419
420; Clear environment in FPM workers
421; Prevents arbitrary environment variables from reaching FPM worker processes
422; by clearing the environment in workers before env vars specified in this
423; pool configuration are added.
424; Setting to "no" will make all environment variables available to PHP code
425; via getenv(), $_ENV and $_SERVER.
426; Default Value: yes
427;clear_env = no
428
429; Limits the extensions of the main script FPM will allow to parse. This can
430; prevent configuration mistakes on the web server side. You should only limit
431; FPM to .php extensions to prevent malicious users to use other extensions to
432; execute php code.
433; Note: set an empty value to allow all extensions.
434; Default Value: .php
435;security.limit_extensions = .php .php3 .php4 .php5 .php7
436
437; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
438; the current environment.
439; Default Value: clean env
440;env[HOSTNAME] = $HOSTNAME
441;env[PATH] = /usr/local/bin:/usr/bin:/bin
442;env[TMP] = /tmp
443;env[TMPDIR] = /tmp
444;env[TEMP] = /tmp
445
446; Additional php.ini defines, specific to this pool of workers. These settings
447; overwrite the values previously defined in the php.ini. The directives are the
448; same as the PHP SAPI:
449;   php_value/php_flag             - you can set classic ini defines which can
450;                                    be overwritten from PHP call 'ini_set'.
451;   php_admin_value/php_admin_flag - these directives won't be overwritten by
452;                                     PHP call 'ini_set'
453; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
454
455; Defining 'extension' will load the corresponding shared extension from
456; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
457; overwrite previously defined php.ini values, but will append the new value
458; instead.
459
460; Note: path INI options can be relative and will be expanded with the prefix
461; (pool, global or @prefix@)
462
463; Default Value: nothing is defined by default except the values in php.ini and
464;                specified at startup with the -d argument
465;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
466;php_flag[display_errors] = off
467;php_admin_value[error_log] = /var/log/fpm-php.www.log
468;php_admin_flag[log_errors] = on
469;php_admin_value[memory_limit] = 32M
470