天天看点

php-fpm.conf 配置说明

Structure

<?xml version="1.0" ?> <configuration> <section name="global_options">  (See "Global Options" below) </section> <workers>  <section name="pool"> (One section per pool) (See "Worker Sections" below)  </section> </workers>       

Global Options

  • pid_file - Pid file. Default: what has been compiled in with --with-fpm-pid
  • error_log - Error log file. Default: what has been compiled in with --with-fpm-log
  • log_level - Log level. Default: "notice" (levels: "DEBUG", "NOTICE", "WARNING", "ERROR", "ALERT")
  • emergency_restart_threshold - When this amount of php processes exited with SIGSEGV or SIGBUS ... Default: 10
  • emergency_restart_interval - ... in a less than this interval of time, a graceful restart will be initiated. Useful to work around accidental corruptions in accelerator's shared memory. Default: "1m"
  • process_control_timeout - Time limit on waiting child's reaction on signals from master. Default: "5s"
  • daemonize - say "no" to debug FPM or run it under a supervisor (runit/sv, daemontools, upstart, etc.) Default: "yes"

Worker Sections

  • name - Name of pool. Used in logs and stats. Default: "default"
  • listen_address - Address to accept fastcgi requests on. Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket'. Default: 127.0.0.1:9000
  • listen_options (node)
    • backlog - listen(2) backlog. Default: -1
    • owner - www-data - the user that the socket will be created as
    • group - www-data - the group that the socket will be created as
    • mode - Set permissions for unix socket, if one used. In Linux read/write permissions must be set in order to allow connections from web server. Many BSD-derived systems allow connections regardless of permissions. Default: 0666
  • user - Unix user of processes. Default "www-data"
  • group - Unix group of processes. Default "www-data"
  • php_defines - (node) Additional php.ini defines, specific to this pool of workers.
    • display_errors - an example option. can be helpful for separate dev and production pools
  • request_terminate_timeout - The timeout (in seconds) for serving a single request after which the worker process will be terminated. Should be used when 'max_execution_time' ini option does not stop script execution for some reason. Default: "5s". Note: '0s' means 'off'
  • request_slowlog_timeout - The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file. Default: "5s". Note: '0s' means 'off'
  • slowlog - The log file for slow requests.
  • max_requests - How much requests each process should execute before respawn. Useful to work around memory leaks in 3rd party libraries. For endless request processing please specify 0. Equivalent to PHP_FCGI_MAX_REQUESTS.
  • pm - (node) Process manager settings nodes
    • style - Sets style of controling worker process count. Valid values are 'static' and 'apache-like'. Default "static". NOTE: only 'static' has effect currently
    • max_children - Sets the limit on the number of simultaneous requests that will be served. Equivalent to Apache MaxClients directive. Equivalent to PHP_FCGI_CHILDREN environment variable. Used with any pm_style.
    • apache_like - (node) Settings group for 'apache-like' pm style
      • StartServers - Sets the number of server processes created on startup. Used only when 'apache-like' pm_style is selected
      • MinSpareServers - Sets the desired minimum number of idle server processes. Used only when 'apache-like' pm_style is selected
      • MaxSpareServers - Sets the desired maximum number of idle server processes. Used only when 'apache-like' pm_style is selected
    • rlimit_files - Set open file desc rlimit. Default: 1024
    • rlimit_core - Set max core size rlimit. Default: 0
    • chroot - Chroot to this directory at the start, absolute path. Default empty.
    • chdir - Chdir to this directory at the start, absolute path. Default empty.
    • catch_workers_output - Redirect workers' stdout and stderr into main error log. If not set, they will be redirected to /dev/null, according to FastCGI specs. Values "yes" or "no"
    • allowed_clients - Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect. Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2+) Makes sense only with AF_INET listening socket. Default: 127.0.0.1
    • environment - Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from current environment
      • HOSTNAME - for example, $HOSTNAME
      • PATH - you can inherit path from $PATH or define your own
      • TMP - for example, /tmp
      • TEMP - for example, /tmp

摘自:http://php-fpm.org/wiki/Configuration_File