Ticket #670: php53-fpm.conf.txt

File php53-fpm.conf.txt, 20.4 KB (added by chris, 3 years ago)

/opt/local/etc/php53-fpm.conf

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