Advertisement
Ajtak

PHP-FPM www.conf

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