PHP-FPM構成

7163 ワード

統合環境を使用せず、インストール構成PHPを最初から学習します.
PHP-FPM構成
パラメータ|説明-p|コマンドラインで動的に変更--prefix;include=etc/fpm.d/*.conf|は、glob(3)が存在する場合(glob()関数が指定したモードに一致するファイル名またはディレクトリを返す場合)に1つ以上のファイルを含むために使用されます.
グローバル構成
;pid = run/php-fpm.pid        pid     ,       /usr/local/php/var
;error_log = log/php-fpm.log           ,       /usr/local/php/var
;syslog.facility = daemon                   。
;syslog.ident = php-fpm        FPM     
;log_level = notice               ,  notice,   alert, error, warning, notice, debug
;emergency_restart_threshold = 0               IGSEGV SIGBUS  ,   fpm,  0        
;emergency_restart_interval = 0                  (    :s ),  s ,m ,h ,d 
;process_control_timeout = 0         master        (    :s ),  s ,m ,h ,d 
; process.max = 128                ,      
; process.priority = -19        nice(2)       -19(  ) 20(  )
;rlimit_files = 1024                  rlimit   
;rlimit_core = 0                rlimit    
;events.mechanism = epoll         event     
  ; - select     (any POSIX os)
  ; - poll       (any POSIX os)
  ; - epoll      (linux >= 2.5.44)
  ; - kqueue     (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0)
  ; - /dev/poll  (Solaris >= 7)
  ; - port       (Solaris >= 10)
;daemonize = yes            fpm      ,     “no”,  fpm      
;systemd_interval = 10

プロセスプールの定義
[www]
; It only applies on the following directives:
; - 'access.log'
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
; - 'chdir'
; - 'php_values'
; - 'php_admin_values'

;prefix = /path/to/pools/$pool         ,     prefix  
user = nobody                        ,  user     ,group  
group = nobody
listen = 127.0.0.1:9000         ip   
;listen.backlog = 65535         listen(2)  backlog
;listen.owner = nobody
;listen.group = nobody
;listen.mode = 0660
;listen.acl_users =
;listen.acl_groups =
;listen.allowed_clients = 127.0.0.1   FastCGI      IPv4  ,     ','  ,               
; process.priority = -19
pm = dynamic                                
  static:                    (pm.max_children)
  dynamic:            ,             (   dynamic    )
    pm.max_children:                   
    pm.start_servers:             
    pm.min_spare_servers:     "idle"        ,             ,            
    pm.max_spare_servers:          ,            ,            。
  ondemand:         ,              (pm.max_children, pm.process_idle_timeout)

pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
;pm.process_idle_timeout = 10s;          
;pm.max_requests = 500                 ,               ,               ,   0     
;pm.status_path = /status            URI,    fpm   
     :
  accepted conn:            
  pool:       
  process manager:     ,     pm  ,     static,dynamic,ondemand
  idle processes:       
  active processes:          
  total processes:       =idle+active
  max children reached:           ,       , pm             (  pm   dynamic )
;ping.path = /ping     ping URI     fpm    ,        ,     URI   ping 
;ping.response = pong            ,     text/plain( 200    )
;access.log = log/$pool.access.log
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
  ; The following syntax is allowed
  ;  %%: the '%' character
  ;  %C: %CPU used by the request
  ;      it can accept the following format:
  ;      - %{user}C for user CPU only
  ;      - %{system}C for system CPU only
  ;      - %{total}C  for user + system CPU (default)
  ;  %d: time taken to serve the request
  ;      it can accept the following format:
  ;      - %{seconds}d (default)
  ;      - %{miliseconds}d
  ;      - %{mili}d
  ;      - %{microseconds}d
  ;      - %{micro}d
  ;  %e: an environment variable (same as $_ENV or $_SERVER)
  ;      it must be associated with embraces to specify the name of the env
  ;      variable. Some exemples:
  ;      - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
  ;      - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
  ;  %f: script filename
  ;  %l: content-length of the request (for POST request only)
  ;  %m: request method
  ;  %M: peak of memory allocated by PHP
  ;      it can accept the following format:
  ;      - %{bytes}M (default)
  ;      - %{kilobytes}M
  ;      - %{kilo}M
  ;      - %{megabytes}M
  ;      - %{mega}M
  ;  %n: pool name
  ;  %o: output header
  ;      it must be associated with embraces to specify the name of the header:
  ;      - %{Content-Type}o
  ;      - %{X-Powered-By}o
  ;      - %{Transfert-Encoding}o
  ;      - ....
  ;  %p: PID of the child that serviced the request
  ;  %P: PID of the parent of the child that serviced the request
  ;  %q: the query string
  ;  %Q: the '?' character if query string exists
  ;  %r: the request URI (without the query string, see %q and %Q)
  ;  %R: remote IP address
  ;  %s: status (response code)
  ;  %t: server time the request was received
  ;      it can accept a strftime(3) format:
  ;      %d/%b/%Y:%H:%M:%S %z (default)
  ;  %T: time the log has been written (the request has finished)
  ;      it can accept a strftime(3) format:
  ;      %d/%b/%Y:%H:%M:%S %z (default)
  ;  %u: remote user
;slowlog = log/$pool.log.slow          
;request_slowlog_timeout = 0             ,   php      。
;request_terminate_timeout = 0          , worker       ,           。              ,       ,0       
  ( php.ini ,max_execution_time      30,              )
;rlimit_files = 1024                    
;rlimit_core = 0                       ,      
;chroot =                 chroot  ,        chroot         ,             
;chdir = /var/www                          (       ,       chroot  “/”  )    
;catch_workers_output = yes     worker                        ,      ,  FastCGI   ,       /dev/null 
;clear_env = no                
;security.limit_extensions = .php .php3 .php4 .php5    FPM        
;env[HOSTNAME] = $HOSTNAME
;env[PATH] = /usr/local/bin:/usr/bin:/bin
;env[TMP] = /tmp
;env[TMPDIR] = /tmp
;env[TEMP] = /tmp

; Additional php.ini defines, specific to this pool of workers. These settings
; overwrite the values previously defined in the php.ini. The directives are the
; same as the PHP SAPI:
;   php_value/php_flag             - you can set classic ini defines which can
;                                    be overwritten from PHP call 'ini_set'.
;   php_admin_value/php_admin_flag - these directives won't be overwritten by
;                                     PHP call 'ini_set'
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.

; Defining 'extension' will load the corresponding shared extension from
; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
; overwrite previously defined php.ini values, but will append the new value
; instead.

;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f [email protected]
;php_flag[display_errors] = off
;php_admin_value[error_log] = /var/log/fpm-php.www.log
;php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 32M