php-fpm.conf 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. ; Start a new pool named 'www'.
  2. ; the variable $pool can we used in any directive and will be replaced by the
  3. ; pool name ('www' here)
  4. [__NAMETOCHANGE__]
  5. ; Per pool prefix
  6. ; It only applies on the following directives:
  7. ; - 'slowlog'
  8. ; - 'listen' (unixsocket)
  9. ; - 'chroot'
  10. ; - 'chdir'
  11. ; - 'php_values'
  12. ; - 'php_admin_values'
  13. ; When not set, the global prefix (or /usr) applies instead.
  14. ; Note: This directive can also be relative to the global prefix.
  15. ; Default Value: none
  16. ;prefix = /path/to/pools/$pool
  17. ; Unix user/group of processes
  18. ; Note: The user is mandatory. If the group is not set, the default user's group
  19. ; will be used.
  20. user = __USER__
  21. group = __USER__
  22. ; The address on which to accept FastCGI requests.
  23. ; Valid syntaxes are:
  24. ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
  25. ; a specific port;
  26. ; 'port' - to listen on a TCP socket to all addresses on a
  27. ; specific port;
  28. ; '/path/to/unix/socket' - to listen on a unix socket.
  29. ; Note: This value is mandatory.
  30. listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock
  31. ; Set listen(2) backlog. A value of '-1' means unlimited.
  32. ; Default Value: 128 (-1 on FreeBSD and OpenBSD)
  33. ;listen.backlog = 128
  34. ; Set permissions for unix socket, if one is used. In Linux, read/write
  35. ; permissions must be set in order to allow connections from a web server. Many
  36. ; BSD-derived systems allow connections regardless of permissions.
  37. ; Default Values: user and group are set as the running user
  38. ; mode is set to 0660
  39. listen.owner = www-data
  40. listen.group = www-data
  41. ;listen.mode = 0660
  42. ; List of ipv4 addresses of FastCGI clients which are allowed to connect.
  43. ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
  44. ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
  45. ; must be separated by a comma. If this value is left blank, connections will be
  46. ; accepted from any ip address.
  47. ; Default Value: any
  48. ;listen.allowed_clients = 127.0.0.1
  49. ; Specify the nice(2) priority to apply to the pool processes (only if set)
  50. ; The value can vary from -19 (highest priority) to 20 (lower priority)
  51. ; Note: - It will only work if the FPM master process is launched as root
  52. ; - The pool processes will inherit the master process priority
  53. ; unless it specified otherwise
  54. ; Default Value: no set
  55. ; priority = -19
  56. ; Choose how the process manager will control the number of child processes.
  57. ; Possible Values:
  58. ; static - a fixed number (pm.max_children) of child processes;
  59. ; dynamic - the number of child processes are set dynamically based on the
  60. ; following directives. With this process management, there will be
  61. ; always at least 1 children.
  62. ; pm.max_children - the maximum number of children that can
  63. ; be alive at the same time.
  64. ; pm.start_servers - the number of children created on startup.
  65. ; pm.min_spare_servers - the minimum number of children in 'idle'
  66. ; state (waiting to process). If the number
  67. ; of 'idle' processes is less than this
  68. ; number then some children will be created.
  69. ; pm.max_spare_servers - the maximum number of children in 'idle'
  70. ; state (waiting to process). If the number
  71. ; of 'idle' processes is greater than this
  72. ; number then some children will be killed.
  73. ; ondemand - no children are created at startup. Children will be forked when
  74. ; new requests will connect. The following parameter are used:
  75. ; pm.max_children - the maximum number of children that
  76. ; can be alive at the same time.
  77. ; pm.process_idle_timeout - The number of seconds after which
  78. ; an idle process will be killed.
  79. ; Note: This value is mandatory.
  80. pm = dynamic
  81. ; The number of child processes to be created when pm is set to 'static' and the
  82. ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
  83. ; This value sets the limit on the number of simultaneous requests that will be
  84. ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
  85. ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
  86. ; CGI. The below defaults are based on a server without much resources. Don't
  87. ; forget to tweak pm.* to fit your needs.
  88. ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
  89. ; Note: This value is mandatory.
  90. pm.max_children = 10
  91. ; The number of child processes created on startup.
  92. ; Note: Used only when pm is set to 'dynamic'
  93. ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
  94. pm.start_servers = 2
  95. ; The desired minimum number of idle server processes.
  96. ; Note: Used only when pm is set to 'dynamic'
  97. ; Note: Mandatory when pm is set to 'dynamic'
  98. pm.min_spare_servers = 1
  99. ; The desired maximum number of idle server processes.
  100. ; Note: Used only when pm is set to 'dynamic'
  101. ; Note: Mandatory when pm is set to 'dynamic'
  102. pm.max_spare_servers = 3
  103. ; The number of seconds after which an idle process will be killed.
  104. ; Note: Used only when pm is set to 'ondemand'
  105. ; Default Value: 10s
  106. ;pm.process_idle_timeout = 10s;
  107. ; The number of requests each child process should execute before respawning.
  108. ; This can be useful to work around memory leaks in 3rd party libraries. For
  109. ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
  110. ; Default Value: 0
  111. pm.max_requests = 500
  112. ; The URI to view the FPM status page. If this value is not set, no URI will be
  113. ; recognized as a status page. It shows the following informations:
  114. ; pool - the name of the pool;
  115. ; process manager - static, dynamic or ondemand;
  116. ; start time - the date and time FPM has started;
  117. ; start since - number of seconds since FPM has started;
  118. ; accepted conn - the number of request accepted by the pool;
  119. ; listen queue - the number of request in the queue of pending
  120. ; connections (see backlog in listen(2));
  121. ; max listen queue - the maximum number of requests in the queue
  122. ; of pending connections since FPM has started;
  123. ; listen queue len - the size of the socket queue of pending connections;
  124. ; idle processes - the number of idle processes;
  125. ; active processes - the number of active processes;
  126. ; total processes - the number of idle + active processes;
  127. ; max active processes - the maximum number of active processes since FPM
  128. ; has started;
  129. ; max children reached - number of times, the process limit has been reached,
  130. ; when pm tries to start more children (works only for
  131. ; pm 'dynamic' and 'ondemand');
  132. ; Value are updated in real time.
  133. ; Example output:
  134. ; pool: www
  135. ; process manager: static
  136. ; start time: 01/Jul/2011:17:53:49 +0200
  137. ; start since: 62636
  138. ; accepted conn: 190460
  139. ; listen queue: 0
  140. ; max listen queue: 1
  141. ; listen queue len: 42
  142. ; idle processes: 4
  143. ; active processes: 11
  144. ; total processes: 15
  145. ; max active processes: 12
  146. ; max children reached: 0
  147. ;
  148. ; By default the status page output is formatted as text/plain. Passing either
  149. ; 'html', 'xml' or 'json' in the query string will return the corresponding
  150. ; output syntax. Example:
  151. ; http://www.foo.bar/status
  152. ; http://www.foo.bar/status?json
  153. ; http://www.foo.bar/status?html
  154. ; http://www.foo.bar/status?xml
  155. ;
  156. ; By default the status page only outputs short status. Passing 'full' in the
  157. ; query string will also return status for each pool process.
  158. ; Example:
  159. ; http://www.foo.bar/status?full
  160. ; http://www.foo.bar/status?json&full
  161. ; http://www.foo.bar/status?html&full
  162. ; http://www.foo.bar/status?xml&full
  163. ; The Full status returns for each process:
  164. ; pid - the PID of the process;
  165. ; state - the state of the process (Idle, Running, ...);
  166. ; start time - the date and time the process has started;
  167. ; start since - the number of seconds since the process has started;
  168. ; requests - the number of requests the process has served;
  169. ; request duration - the duration in µs of the requests;
  170. ; request method - the request method (GET, POST, ...);
  171. ; request URI - the request URI with the query string;
  172. ; content length - the content length of the request (only with POST);
  173. ; user - the user (PHP_AUTH_USER) (or '-' if not set);
  174. ; script - the main script called (or '-' if not set);
  175. ; last request cpu - the %cpu the last request consumed
  176. ; it's always 0 if the process is not in Idle state
  177. ; because CPU calculation is done when the request
  178. ; processing has terminated;
  179. ; last request memory - the max amount of memory the last request consumed
  180. ; it's always 0 if the process is not in Idle state
  181. ; because memory calculation is done when the request
  182. ; processing has terminated;
  183. ; If the process is in Idle state, then informations are related to the
  184. ; last request the process has served. Otherwise informations are related to
  185. ; the current request being served.
  186. ; Example output:
  187. ; ************************
  188. ; pid: 31330
  189. ; state: Running
  190. ; start time: 01/Jul/2011:17:53:49 +0200
  191. ; start since: 63087
  192. ; requests: 12808
  193. ; request duration: 1250261
  194. ; request method: GET
  195. ; request URI: /test_mem.php?N=10000
  196. ; content length: 0
  197. ; user: -
  198. ; script: /home/fat/web/docs/php/test_mem.php
  199. ; last request cpu: 0.00
  200. ; last request memory: 0
  201. ;
  202. ; Note: There is a real-time FPM status monitoring sample web page available
  203. ; It's available in: ${prefix}/share/fpm/status.html
  204. ;
  205. ; Note: The value must start with a leading slash (/). The value can be
  206. ; anything, but it may not be a good idea to use the .php extension or it
  207. ; may conflict with a real PHP file.
  208. ; Default Value: not set
  209. ;pm.status_path = /status
  210. ; The ping URI to call the monitoring page of FPM. If this value is not set, no
  211. ; URI will be recognized as a ping page. This could be used to test from outside
  212. ; that FPM is alive and responding, or to
  213. ; - create a graph of FPM availability (rrd or such);
  214. ; - remove a server from a group if it is not responding (load balancing);
  215. ; - trigger alerts for the operating team (24/7).
  216. ; Note: The value must start with a leading slash (/). The value can be
  217. ; anything, but it may not be a good idea to use the .php extension or it
  218. ; may conflict with a real PHP file.
  219. ; Default Value: not set
  220. ;ping.path = /ping
  221. ; This directive may be used to customize the response of a ping request. The
  222. ; response is formatted as text/plain with a 200 response code.
  223. ; Default Value: pong
  224. ;ping.response = pong
  225. ; The access log file
  226. ; Default: not set
  227. ;access.log = log/$pool.access.log
  228. ; The access log format.
  229. ; The following syntax is allowed
  230. ; %%: the '%' character
  231. ; %C: %CPU used by the request
  232. ; it can accept the following format:
  233. ; - %{user}C for user CPU only
  234. ; - %{system}C for system CPU only
  235. ; - %{total}C for user + system CPU (default)
  236. ; %d: time taken to serve the request
  237. ; it can accept the following format:
  238. ; - %{seconds}d (default)
  239. ; - %{miliseconds}d
  240. ; - %{mili}d
  241. ; - %{microseconds}d
  242. ; - %{micro}d
  243. ; %e: an environment variable (same as $_ENV or $_SERVER)
  244. ; it must be associated with embraces to specify the name of the env
  245. ; variable. Some exemples:
  246. ; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
  247. ; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
  248. ; %f: script filename
  249. ; %l: content-length of the request (for POST request only)
  250. ; %m: request method
  251. ; %M: peak of memory allocated by PHP
  252. ; it can accept the following format:
  253. ; - %{bytes}M (default)
  254. ; - %{kilobytes}M
  255. ; - %{kilo}M
  256. ; - %{megabytes}M
  257. ; - %{mega}M
  258. ; %n: pool name
  259. ; %o: ouput header
  260. ; it must be associated with embraces to specify the name of the header:
  261. ; - %{Content-Type}o
  262. ; - %{X-Powered-By}o
  263. ; - %{Transfert-Encoding}o
  264. ; - ....
  265. ; %p: PID of the child that serviced the request
  266. ; %P: PID of the parent of the child that serviced the request
  267. ; %q: the query string
  268. ; %Q: the '?' character if query string exists
  269. ; %r: the request URI (without the query string, see %q and %Q)
  270. ; %R: remote IP address
  271. ; %s: status (response code)
  272. ; %t: server time the request was received
  273. ; it can accept a strftime(3) format:
  274. ; %d/%b/%Y:%H:%M:%S %z (default)
  275. ; %T: time the log has been written (the request has finished)
  276. ; it can accept a strftime(3) format:
  277. ; %d/%b/%Y:%H:%M:%S %z (default)
  278. ; %u: remote user
  279. ;
  280. ; Default: "%R - %u %t \"%m %r\" %s"
  281. ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
  282. ; The log file for slow requests
  283. ; Default Value: not set
  284. ; Note: slowlog is mandatory if request_slowlog_timeout is set
  285. slowlog = /var/log/nginx/__NAMETOCHANGE__.slow.log
  286. ; The timeout for serving a single request after which a PHP backtrace will be
  287. ; dumped to the 'slowlog' file. A value of '0s' means 'off'.
  288. ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
  289. ; Default Value: 0
  290. request_slowlog_timeout = 5s
  291. ; The timeout for serving a single request after which the worker process will
  292. ; be killed. This option should be used when the 'max_execution_time' ini option
  293. ; does not stop script execution for some reason. A value of '0' means 'off'.
  294. ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
  295. ; Default Value: 0
  296. request_terminate_timeout = 1d
  297. ; Set open file descriptor rlimit.
  298. ; Default Value: system defined value
  299. ;rlimit_files = 1024
  300. ; Set max core size rlimit.
  301. ; Possible Values: 'unlimited' or an integer greater or equal to 0
  302. ; Default Value: system defined value
  303. ;rlimit_core = 0
  304. ; Chroot to this directory at the start. This value must be defined as an
  305. ; absolute path. When this value is not set, chroot is not used.
  306. ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
  307. ; of its subdirectories. If the pool prefix is not set, the global prefix
  308. ; will be used instead.
  309. ; Note: chrooting is a great security feature and should be used whenever
  310. ; possible. However, all PHP paths will be relative to the chroot
  311. ; (error_log, sessions.save_path, ...).
  312. ; Default Value: not set
  313. ;chroot =
  314. ; Chdir to this directory at the start.
  315. ; Note: relative path can be used.
  316. ; Default Value: current directory or / when chroot
  317. chdir = __FINALPATH__
  318. ; Redirect worker stdout and stderr into main error log. If not set, stdout and
  319. ; stderr will be redirected to /dev/null according to FastCGI specs.
  320. ; Note: on highloaded environement, this can cause some delay in the page
  321. ; process time (several ms).
  322. ; Default Value: no
  323. catch_workers_output = yes
  324. ; Limits the extensions of the main script FPM will allow to parse. This can
  325. ; prevent configuration mistakes on the web server side. You should only limit
  326. ; FPM to .php extensions to prevent malicious users to use other extensions to
  327. ; exectute php code.
  328. ; Note: set an empty value to allow all extensions.
  329. ; Default Value: .php
  330. ;security.limit_extensions = .php .php3 .php4 .php5 .php7
  331. ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
  332. ; the current environment.
  333. ; Default Value: clean env
  334. ;env[HOSTNAME] = $HOSTNAME
  335. ;env[PATH] = /usr/local/bin:/usr/bin:/bin
  336. ;env[TMP] = /tmp
  337. ;env[TMPDIR] = /tmp
  338. ;env[TEMP] = /tmp
  339. ; Additional php.ini defines, specific to this pool of workers. These settings
  340. ; overwrite the values previously defined in the php.ini. The directives are the
  341. ; same as the PHP SAPI:
  342. ; php_value/php_flag - you can set classic ini defines which can
  343. ; be overwritten from PHP call 'ini_set'.
  344. ; php_admin_value/php_admin_flag - these directives won't be overwritten by
  345. ; PHP call 'ini_set'
  346. ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
  347. ; Defining 'extension' will load the corresponding shared extension from
  348. ; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
  349. ; overwrite previously defined php.ini values, but will append the new value
  350. ; instead.
  351. ; Note: path INI options can be relative and will be expanded with the prefix
  352. ; (pool, global or /usr)
  353. ; Default Value: nothing is defined by default except the values in php.ini and
  354. ; specified at startup with the -d argument
  355. ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
  356. ;php_flag[display_errors] = off
  357. ;php_admin_value[error_log] = /var/log/fpm-php.www.log
  358. ;php_admin_flag[log_errors] = on
  359. ;php_admin_value[memory_limit] = 32M
  360. ; Common values to change to increase file upload limit
  361. ; php_admin_value[upload_max_filesize] = 50M
  362. ; php_admin_value[post_max_size] = 50M
  363. ; php_admin_flag[mail.add_x_header] = Off
  364. ; Other common parameters
  365. ; php_admin_value[max_execution_time] = 600
  366. ; php_admin_value[max_input_time] = 300
  367. ; php_admin_value[memory_limit] = 256M
  368. ; php_admin_flag[short_open_tag] = On