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