]> git.somenet.org - root/pub/somesible.git/blob - roles/server/nginx/vhost-unified/files/default/php-fpm-www.conf
[roles/server/nginx/vhost-unified] create nginx vhost
[root/pub/somesible.git] / roles / server / nginx / vhost-unified / files / default / php-fpm-www.conf
1 ;#
2 ;################################################
3 ;### Managed by someone's ansible provisioner ###
4 ;################################################
5 ;# Part of: https://git.somenet.org/root/pub/somesible.git
6 ;# 2017-2024 by someone <someone@somenet.org>
7 ;#
8 ; Start a new pool named 'www'.
9 ; the variable $pool can be used in any directive and will be replaced by the
10 ; pool name ('www' here)
11 [www]
12
13 ; Per pool prefix
14 ; It only applies on the following directives:
15 ; - 'access.log'
16 ; - 'slowlog'
17 ; - 'listen' (unixsocket)
18 ; - 'chroot'
19 ; - 'chdir'
20 ; - 'php_values'
21 ; - 'php_admin_values'
22 ; When not set, the global prefix (or /usr) applies instead.
23 ; Note: This directive can also be relative to the global prefix.
24 ; Default Value: none
25 ;prefix = /path/to/pools/$pool
26
27 ; Unix user/group of the child processes. This can be used only if the master
28 ; process running user is root. It is set after the child process is created.
29 ; The user and group can be specified either by their name or by their numeric
30 ; IDs.
31 ; Note: If the user is root, the executable needs to be started with
32 ;       --allow-to-run-as-root option to work.
33 ; Default Values: The user is set to master process running user by default.
34 ;                 If the group is not set, the user's group is used.
35 user = www-data
36 group = www-data
37
38 ; The address on which to accept FastCGI requests.
39 ; Valid syntaxes are:
40 ;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific IPv4 address on
41 ;                            a specific port;
42 ;   '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
43 ;                            a specific port;
44 ;   'port'                 - to listen on a TCP socket to all addresses
45 ;                            (IPv6 and IPv4-mapped) on a specific port;
46 ;   '/path/to/unix/socket' - to listen on a unix socket.
47 ; Note: This value is mandatory.
48 listen = /run/php/php-fpm.sock
49
50 ; Set listen(2) backlog.
51 ; Default Value: 511 (-1 on Linux, FreeBSD and OpenBSD)
52 ;listen.backlog = 511
53
54 ; Set permissions for unix socket, if one is used. In Linux, read/write
55 ; permissions must be set in order to allow connections from a web server. Many
56 ; BSD-derived systems allow connections regardless of permissions. The owner
57 ; and group can be specified either by name or by their numeric IDs.
58 ; Default Values: Owner is set to the master process running user. If the group
59 ;                 is not set, the owner's group is used. Mode is set to 0660.
60 listen.owner = www-data
61 listen.group = www-data
62 ;listen.mode = 0660
63 ; When POSIX Access Control Lists are supported you can set them using
64 ; these options, value is a comma separated list of user/group names.
65 ; When set, listen.owner and listen.group are ignored
66 ;listen.acl_users =
67 ;listen.acl_groups =
68
69 ; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
70 ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
71 ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
72 ; must be separated by a comma. If this value is left blank, connections will be
73 ; accepted from any ip address.
74 ; Default Value: any
75 ;listen.allowed_clients = 127.0.0.1
76
77 ; Set the associated the route table (FIB). FreeBSD only
78 ; Default Value: -1
79 ;listen.setfib = 1
80
81 ; Specify the nice(2) priority to apply to the pool processes (only if set)
82 ; The value can vary from -19 (highest priority) to 20 (lower priority)
83 ; Note: - It will only work if the FPM master process is launched as root
84 ;       - The pool processes will inherit the master process priority
85 ;         unless it specified otherwise
86 ; Default Value: no set
87 ; process.priority = -19
88
89 ; Set the process dumpable flag (PR_SET_DUMPABLE prctl for Linux or
90 ; PROC_TRACE_CTL procctl for FreeBSD) even if the process user
91 ; or group is different than the master process user. It allows to create process
92 ; core dump and ptrace the process for the pool user.
93 ; Default Value: no
94 ; process.dumpable = yes
95
96 ; Choose how the process manager will control the number of child processes.
97 ; Possible Values:
98 ;   static  - a fixed number (pm.max_children) of child processes;
99 ;   dynamic - the number of child processes are set dynamically based on the
100 ;             following directives. With this process management, there will be
101 ;             always at least 1 children.
102 ;             pm.max_children      - the maximum number of children that can
103 ;                                    be alive at the same time.
104 ;             pm.start_servers     - the number of children created on startup.
105 ;             pm.min_spare_servers - the minimum number of children in 'idle'
106 ;                                    state (waiting to process). If the number
107 ;                                    of 'idle' processes is less than this
108 ;                                    number then some children will be created.
109 ;             pm.max_spare_servers - the maximum number of children in 'idle'
110 ;                                    state (waiting to process). If the number
111 ;                                    of 'idle' processes is greater than this
112 ;                                    number then some children will be killed.
113 ;             pm.max_spawn_rate    - the maximum number of rate to spawn child
114 ;                                    processes at once.
115 ;  ondemand - no children are created at startup. Children will be forked when
116 ;             new requests will connect. The following parameter are used:
117 ;             pm.max_children           - the maximum number of children that
118 ;                                         can be alive at the same time.
119 ;             pm.process_idle_timeout   - The number of seconds after which
120 ;                                         an idle process will be killed.
121 ; Note: This value is mandatory.
122 pm = dynamic
123
124 ; The number of child processes to be created when pm is set to 'static' and the
125 ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
126 ; This value sets the limit on the number of simultaneous requests that will be
127 ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
128 ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
129 ; CGI. The below defaults are based on a server without much resources. Don't
130 ; forget to tweak pm.* to fit your needs.
131 ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
132 ; Note: This value is mandatory.
133 pm.max_children = 64
134
135 ; The number of child processes created on startup.
136 ; Note: Used only when pm is set to 'dynamic'
137 ; Default Value: (min_spare_servers + max_spare_servers) / 2
138 pm.start_servers = 1
139
140 ; The desired minimum number of idle server processes.
141 ; Note: Used only when pm is set to 'dynamic'
142 ; Note: Mandatory when pm is set to 'dynamic'
143 pm.min_spare_servers = 1
144
145 ; The desired maximum number of idle server processes.
146 ; Note: Used only when pm is set to 'dynamic'
147 ; Note: Mandatory when pm is set to 'dynamic'
148 pm.max_spare_servers = 2
149
150 ; The number of rate to spawn child processes at once.
151 ; Note: Used only when pm is set to 'dynamic'
152 ; Note: Mandatory when pm is set to 'dynamic'
153 ; Default Value: 32
154 ;pm.max_spawn_rate = 32
155
156 ; The number of seconds after which an idle process will be killed.
157 ; Note: Used only when pm is set to 'ondemand'
158 ; Default Value: 10s
159 ;pm.process_idle_timeout = 10s;
160
161 ; The number of requests each child process should execute before respawning.
162 ; This can be useful to work around memory leaks in 3rd party libraries. For
163 ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
164 ; Default Value: 0
165 pm.max_requests = 100
166
167 ; The URI to view the FPM status page. If this value is not set, no URI will be
168 ; recognized as a status page. It shows the following information:
169 ;   pool                 - the name of the pool;
170 ;   process manager      - static, dynamic or ondemand;
171 ;   start time           - the date and time FPM has started;
172 ;   start since          - number of seconds since FPM has started;
173 ;   accepted conn        - the number of request accepted by the pool;
174 ;   listen queue         - the number of request in the queue of pending
175 ;                          connections (see backlog in listen(2));
176 ;   max listen queue     - the maximum number of requests in the queue
177 ;                          of pending connections since FPM has started;
178 ;   listen queue len     - the size of the socket queue of pending connections;
179 ;   idle processes       - the number of idle processes;
180 ;   active processes     - the number of active processes;
181 ;   total processes      - the number of idle + active processes;
182 ;   max active processes - the maximum number of active processes since FPM
183 ;                          has started;
184 ;   max children reached - number of times, the process limit has been reached,
185 ;                          when pm tries to start more children (works only for
186 ;                          pm 'dynamic' and 'ondemand');
187 ; Value are updated in real time.
188 ; Example output:
189 ;   pool:                 www
190 ;   process manager:      static
191 ;   start time:           01/Jul/2011:17:53:49 +0200
192 ;   start since:          62636
193 ;   accepted conn:        190460
194 ;   listen queue:         0
195 ;   max listen queue:     1
196 ;   listen queue len:     42
197 ;   idle processes:       4
198 ;   active processes:     11
199 ;   total processes:      15
200 ;   max active processes: 12
201 ;   max children reached: 0
202 ;
203 ; By default the status page output is formatted as text/plain. Passing either
204 ; 'html', 'xml' or 'json' in the query string will return the corresponding
205 ; output syntax. Example:
206 ;   http://www.foo.bar/status
207 ;   http://www.foo.bar/status?json
208 ;   http://www.foo.bar/status?html
209 ;   http://www.foo.bar/status?xml
210 ;
211 ; By default the status page only outputs short status. Passing 'full' in the
212 ; query string will also return status for each pool process.
213 ; Example:
214 ;   http://www.foo.bar/status?full
215 ;   http://www.foo.bar/status?json&full
216 ;   http://www.foo.bar/status?html&full
217 ;   http://www.foo.bar/status?xml&full
218 ; The Full status returns for each process:
219 ;   pid                  - the PID of the process;
220 ;   state                - the state of the process (Idle, Running, ...);
221 ;   start time           - the date and time the process has started;
222 ;   start since          - the number of seconds since the process has started;
223 ;   requests             - the number of requests the process has served;
224 ;   request duration     - the duration in Âµs of the requests;
225 ;   request method       - the request method (GET, POST, ...);
226 ;   request URI          - the request URI with the query string;
227 ;   content length       - the content length of the request (only with POST);
228 ;   user                 - the user (PHP_AUTH_USER) (or '-' if not set);
229 ;   script               - the main script called (or '-' if not set);
230 ;   last request cpu     - the %cpu the last request consumed
231 ;                          it's always 0 if the process is not in Idle state
232 ;                          because CPU calculation is done when the request
233 ;                          processing has terminated;
234 ;   last request memory  - the max amount of memory the last request consumed
235 ;                          it's always 0 if the process is not in Idle state
236 ;                          because memory calculation is done when the request
237 ;                          processing has terminated;
238 ; If the process is in Idle state, then informations are related to the
239 ; last request the process has served. Otherwise informations are related to
240 ; the current request being served.
241 ; Example output:
242 ;   ************************
243 ;   pid:                  31330
244 ;   state:                Running
245 ;   start time:           01/Jul/2011:17:53:49 +0200
246 ;   start since:          63087
247 ;   requests:             12808
248 ;   request duration:     1250261
249 ;   request method:       GET
250 ;   request URI:          /test_mem.php?N=10000
251 ;   content length:       0
252 ;   user:                 -
253 ;   script:               /home/fat/web/docs/php/test_mem.php
254 ;   last request cpu:     0.00
255 ;   last request memory:  0
256 ;
257 ; Note: There is a real-time FPM status monitoring sample web page available
258 ;       It's available in: /usr/share/php/7.4/fpm/status.html
259 ;
260 ; Note: The value must start with a leading slash (/). The value can be
261 ;       anything, but it may not be a good idea to use the .php extension or it
262 ;       may conflict with a real PHP file.
263 ; Default Value: not set
264 ;pm.status_path = /status
265
266 ; The address on which to accept FastCGI status request. This creates a new
267 ; invisible pool that can handle requests independently. This is useful
268 ; if the main pool is busy with long running requests because it is still possible
269 ; to get the status before finishing the long running requests.
270 ;
271 ; Valid syntaxes are:
272 ;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific IPv4 address on
273 ;                            a specific port;
274 ;   '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
275 ;                            a specific port;
276 ;   'port'                 - to listen on a TCP socket to all addresses
277 ;                            (IPv6 and IPv4-mapped) on a specific port;
278 ;   '/path/to/unix/socket' - to listen on a unix socket.
279 ; Default Value: value of the listen option
280 ;pm.status_listen = 127.0.0.1:9001
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 %{<strftime_format>}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 %{<strftime_format>}t tag
356 ;      e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
357 ;  %u: remote user
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 precuation, 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 = /var/www
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' or 'disable_classes' will not
484 ; overwrite previously defined php.ini values, but will append the new value
485 ; instead.
486
487 ; Note: path INI options can be relative and will be expanded with the prefix
488 ; (pool, global or /usr)
489
490 ; Default Value: nothing is defined by default except the values in php.ini and
491 ;                specified at startup with the -d argument
492 ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
493 ;php_flag[display_errors] = off
494 ;php_admin_value[error_log] = /var/log/fpm-php.www.log
495 ;php_admin_flag[log_errors] = on
496 php_admin_value[memory_limit] = 1025M
497 php_admin_value[upload_max_filesize] = 1025M
498 php_admin_value[post_max_size] = 1025M