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