─────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │ File: /etc/php/php-fpm.d/www.conf ─────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 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 /usr) 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. 28 │ user = http 29 │ group = http 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. 41 │ listen = /run/php-fpm/php-fpm.sock 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 = http 54 │ listen.group = http 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. 116 │ pm = 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. 127 │ pm.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 132 │ pm.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' 137 │ pm.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' 142 │ pm.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: /usr/share/php/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 │ ; Django : 2026-02-08 260 │ ; default: unset 261 │ pm.status_path = /php-fpm-status 262 │ 263 │ ; The address on which to accept FastCGI status request. This creates a new 264 │ ; invisible pool that can handle requests independently. This is useful 265 │ ; if the main pool is busy with long running requests because it is still possible 266 │ ; to get the status before finishing the long running requests. 267 │ ; 268 │ ; Valid syntaxes are: 269 │ ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on 270 │ ; a specific port; 271 │ ; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on 272 │ ; a specific port; 273 │ ; 'port' - to listen on a TCP socket to all addresses 274 │ ; (IPv6 and IPv4-mapped) on a specific port; 275 │ ; '/path/to/unix/socket' - to listen on a unix socket. 276 │ ; Default Value: value of the listen option 277 │ ;pm.status_listen = 127.0.0.1:9001 278 │ ; Django : 2026-02-08 279 │ ; default: unset 280 │ pm.status_listen = /run/php-fpm/php-fpm-status.sock 281 │ 282 │ ; The ping URI to call the monitoring page of FPM. If this value is not set, no 283 │ ; URI will be recognized as a ping page. This could be used to test from outside 284 │ ; that FPM is alive and responding, or to 285 │ ; - create a graph of FPM availability (rrd or such); 286 │ ; - remove a server from a group if it is not responding (load balancing); 287 │ ; - trigger alerts for the operating team (24/7). 288 │ ; Note: The value must start with a leading slash (/). The value can be 289 │ ; anything, but it may not be a good idea to use the .php extension or it 290 │ ; may conflict with a real PHP file. 291 │ ; Default Value: not set 292 │ ;ping.path = /ping 293 │ 294 │ ; This directive may be used to customize the response of a ping request. The 295 │ ; response is formatted as text/plain with a 200 response code. 296 │ ; Default Value: pong 297 │ ;ping.response = pong 298 │ 299 │ ; The access log file 300 │ ; Default: not set 301 │ ;access.log = log/$pool.access.log 302 │ 303 │ ; The access log format. 304 │ ; The following syntax is allowed 305 │ ; %%: the '%' character 306 │ ; %C: %CPU used by the request 307 │ ; it can accept the following format: 308 │ ; - %{user}C for user CPU only 309 │ ; - %{system}C for system CPU only 310 │ ; - %{total}C for user + system CPU (default) 311 │ ; %d: time taken to serve the request 312 │ ; it can accept the following format: 313 │ ; - %{seconds}d (default) 314 │ ; - %{milliseconds}d 315 │ ; - %{milli}d 316 │ ; - %{microseconds}d 317 │ ; - %{micro}d 318 │ ; %e: an environment variable (same as $_ENV or $_SERVER) 319 │ ; it must be associated with embraces to specify the name of the env 320 │ ; variable. Some examples: 321 │ ; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e 322 │ ; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e 323 │ ; %f: script filename 324 │ ; %l: content-length of the request (for POST request only) 325 │ ; %m: request method 326 │ ; %M: peak of memory allocated by PHP 327 │ ; it can accept the following format: 328 │ ; - %{bytes}M (default) 329 │ ; - %{kilobytes}M 330 │ ; - %{kilo}M 331 │ ; - %{megabytes}M 332 │ ; - %{mega}M 333 │ ; %n: pool name 334 │ ; %o: output header 335 │ ; it must be associated with embraces to specify the name of the header: 336 │ ; - %{Content-Type}o 337 │ ; - %{X-Powered-By}o 338 │ ; - %{Transfert-Encoding}o 339 │ ; - .... 340 │ ; %p: PID of the child that serviced the request 341 │ ; %P: PID of the parent of the child that serviced the request 342 │ ; %q: the query string 343 │ ; %Q: the '?' character if query string exists 344 │ ; %r: the request URI (without the query string, see %q and %Q) 345 │ ; %R: remote IP address 346 │ ; %s: status (response code) 347 │ ; %t: server time the request was received 348 │ ; it can accept a strftime(3) format: 349 │ ; %d/%b/%Y:%H:%M:%S %z (default) 350 │ ; The strftime(3) format must be encapsulated in a %{}t tag 351 │ ; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t 352 │ ; %T: time the log has been written (the request has finished) 353 │ ; it can accept a strftime(3) format: 354 │ ; %d/%b/%Y:%H:%M:%S %z (default) 355 │ ; The strftime(3) format must be encapsulated in a %{}t tag 356 │ ; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t 357 │ ; %u: basic auth user if specified in Authorization header 358 │ ; 359 │ ; Default: "%R - %u %t \"%m %r\" %s" 360 │ ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{milli}d %{kilo}M %C%%" 361 │ 362 │ ; A list of request_uri values which should be filtered from the access log. 363 │ ; 364 │ ; As a security precaution, this setting will be ignored if: 365 │ ; - the request method is not GET or HEAD; or 366 │ ; - there is a request body; or 367 │ ; - there are query parameters; or 368 │ ; - the response code is outwith the successful range of 200 to 299 369 │ ; 370 │ ; Note: The paths are matched against the output of the access.format tag "%r". 371 │ ; On common configurations, this may look more like SCRIPT_NAME than the 372 │ ; expected pre-rewrite URI. 373 │ ; 374 │ ; Default Value: not set 375 │ ;access.suppress_path[] = /ping 376 │ ;access.suppress_path[] = /health_check.php 377 │ 378 │ ; The log file for slow requests 379 │ ; Default Value: not set 380 │ ; Note: slowlog is mandatory if request_slowlog_timeout is set 381 │ ;slowlog = log/$pool.log.slow 382 │ 383 │ ; The timeout for serving a single request after which a PHP backtrace will be 384 │ ; dumped to the 'slowlog' file. A value of '0s' means 'off'. 385 │ ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 386 │ ; Default Value: 0 387 │ ;request_slowlog_timeout = 0 388 │ 389 │ ; Depth of slow log stack trace. 390 │ ; Default Value: 20 391 │ ;request_slowlog_trace_depth = 20 392 │ 393 │ ; The timeout for serving a single request after which the worker process will 394 │ ; be killed. This option should be used when the 'max_execution_time' ini option 395 │ ; does not stop script execution for some reason. A value of '0' means 'off'. 396 │ ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 397 │ ; Default Value: 0 398 │ ;request_terminate_timeout = 0 399 │ 400 │ ; The timeout set by 'request_terminate_timeout' ini option is not engaged after 401 │ ; application calls 'fastcgi_finish_request' or when application has finished and 402 │ ; shutdown functions are being called (registered via register_shutdown_function). 403 │ ; This option will enable timeout limit to be applied unconditionally 404 │ ; even in such cases. 405 │ ; Default Value: no 406 │ ;request_terminate_timeout_track_finished = no 407 │ 408 │ ; Set open file descriptor rlimit. 409 │ ; Default Value: system defined value 410 │ ;rlimit_files = 1024 411 │ 412 │ ; Set max core size rlimit. 413 │ ; Possible Values: 'unlimited' or an integer greater or equal to 0 414 │ ; Default Value: system defined value 415 │ ;rlimit_core = 0 416 │ 417 │ ; Chroot to this directory at the start. This value must be defined as an 418 │ ; absolute path. When this value is not set, chroot is not used. 419 │ ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one 420 │ ; of its subdirectories. If the pool prefix is not set, the global prefix 421 │ ; will be used instead. 422 │ ; Note: chrooting is a great security feature and should be used whenever 423 │ ; possible. However, all PHP paths will be relative to the chroot 424 │ ; (error_log, sessions.save_path, ...). 425 │ ; Default Value: not set 426 │ ;chroot = 427 │ 428 │ ; Chdir to this directory at the start. 429 │ ; Note: relative path can be used. 430 │ ; Default Value: current directory or / when chroot 431 │ ;chdir = /srv/http 432 │ 433 │ ; Redirect worker stdout and stderr into main error log. If not set, stdout and 434 │ ; stderr will be redirected to /dev/null according to FastCGI specs. 435 │ ; Note: on highloaded environment, this can cause some delay in the page 436 │ ; process time (several ms). 437 │ ; Default Value: no 438 │ ;catch_workers_output = yes 439 │ 440 │ ; Decorate worker output with prefix and suffix containing information about 441 │ ; the child that writes to the log and if stdout or stderr is used as well as 442 │ ; log level and time. This options is used only if catch_workers_output is yes. 443 │ ; Settings to "no" will output data as written to the stdout or stderr. 444 │ ; Default value: yes 445 │ ;decorate_workers_output = no 446 │ 447 │ ; Clear environment in FPM workers 448 │ ; Prevents arbitrary environment variables from reaching FPM worker processes 449 │ ; by clearing the environment in workers before env vars specified in this 450 │ ; pool configuration are added. 451 │ ; Setting to "no" will make all environment variables available to PHP code 452 │ ; via getenv(), $_ENV and $_SERVER. 453 │ ; Default Value: yes 454 │ ;clear_env = no 455 │ 456 │ ; Limits the extensions of the main script FPM will allow to parse. This can 457 │ ; prevent configuration mistakes on the web server side. You should only limit 458 │ ; FPM to .php extensions to prevent malicious users to use other extensions to 459 │ ; execute php code. 460 │ ; Note: set an empty value to allow all extensions. 461 │ ; Default Value: .php 462 │ ;security.limit_extensions = .php .php3 .php4 .php5 .php7 463 │ 464 │ ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from 465 │ ; the current environment. 466 │ ; Default Value: clean env 467 │ ;env[HOSTNAME] = $HOSTNAME 468 │ ;env[PATH] = /usr/local/bin:/usr/bin:/bin 469 │ ;env[TMP] = /tmp 470 │ ;env[TMPDIR] = /tmp 471 │ ;env[TEMP] = /tmp 472 │ 473 │ ; Additional php.ini defines, specific to this pool of workers. These settings 474 │ ; overwrite the values previously defined in the php.ini. The directives are the 475 │ ; same as the PHP SAPI: 476 │ ; php_value/php_flag - you can set classic ini defines which can 477 │ ; be overwritten from PHP call 'ini_set'. 478 │ ; php_admin_value/php_admin_flag - these directives won't be overwritten by 479 │ ; PHP call 'ini_set' 480 │ ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. 481 │ 482 │ ; Defining 'extension' will load the corresponding shared extension from 483 │ ; extension_dir. Defining 'disable_functions' will not overwrite previously 484 │ ; defined php.ini values, but will append the new value instead. 485 │ 486 │ ; Note: path INI options can be relative and will be expanded with the prefix 487 │ ; (pool, global or /usr) 489 │ ; Default Value: nothing is defined by default except the values in php.ini and 490 │ ; specified at startup with the -d argument 491 │ ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com 492 │ ;php_flag[display_errors] = off 493 │ ;php_admin_value[error_log] = /var/log/fpm-php.www.log 494 │ ;php_admin_flag[log_errors] = on 495 │ ;php_admin_value[memory_limit] = 32M ─────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────