| This article introduces the configuration method of php-fpm in the php environment, and describes the configuration options and methods of php-fpm in detail. if you need them, refer to them.
This section describes the configuration of php-fpm.
Configure php-fpm: pid = run/php-fpm.pidpid settings, default var/run/php-fpm.pid in the installation directory, it is recommended to enable
Error_log = log/php-fpm.log error log, var/log/php-fpm.log in the installation directory by default
Log_level = notice error level. Available level: alert (must be handled immediately), error (error), warning (warning), notice (important information), debug (debugging information ). Default value: notice.
Expiration = 60emergency_restart_interval = 60s indicates that if the number of php-cgi processes with the SIGSEGV or SIGBUS error exceeded in the value set by emergency_restart_interval, the php-fpm will be restarted elegantly. These two options are generally kept by default.
Process_control_timeout = 0: Set the timeout time for the sub-process to receive the multiplexing signal of the main process. Available unit: s (seconds), m (minutes), h (hours), or d (days) default unit: s (seconds ). Default value: 0.
Daemonize = yes fpm is executed in the background. the default value is yes. you can change it to no for debugging. In FPM, you can use different settings to run multiple process pools. These settings can be set separately for each process pool.
Listen = 127.0.0.1: 9000fpm listening port, that is, the address processed by php in nginx. Generally, the default value is enough. Available Formats: 'Ip: port', 'port', '/path/to/unix/socket '. Each process pool needs to be set.
Listen. backlog =-1 indicates the number of backlogs.-1 indicates no limit. this parameter is determined by the operating system and can be commented out.
Listen. allowed_clients = 127.0.0.1 allows access to the IP address of the FastCGI Process. set any to an unlimited IP address. if you want to set nginx of other hosts, you can also access this FPM process, set the IP address that can be accessed at a cost in listen. The default value is any. Each address is separated by a comma. If it is not set or empty, any server is allowed to request a connection: Listen. owner = wwwlisten. group = wwwlisten. mode = 0666
Unix socket setting options. if you use tcp access, comment it out here.
User = wwwgroup = Account and group for the www startup process
Pm = dynamic: how to control sub-processes? the options include static and dynamic. If static is selected, a fixed number of sub-processes is specified by pm. max_children.
If dynamic is selected, it is determined by the following parameters: Pm. max_children, maximum number of child processes pm. start_servers, number of processes at startup pm. min_spare_servers ensures the minimum number of idle processes. if the number of idle processes is smaller than this value, a new sub-process pm is created. max_spare_servers ensures the maximum number of idle processes. if the number of idle processes exceeds this value, this will be cleared.
For dedicated servers, you can set pm to static.
Pm. max_requests = 1000 set the number of service requests before each sub-process is reborn. It is very useful for third-party modules that may have memory leaks. If it is set to '0', the request is always accepted. Equivalent to the PHP_FCGI_MAX_REQUESTS environment variable. Default value: 0.
Pm. status_path =/statusFPM status page URL. If not set, the status page cannot be accessed. Default value: none.
Ping. path =/pingFPM monitoring page ping URL. If this parameter is not set, the ping page cannot be accessed. This page is used to check whether FPM is alive and can respond to requests. Note that it must start with a slash (/).
Ping. response = pong is used to define the response of ping requests. Return text in the text/plain format of HTTP 200. Default value: pong.
Request_terminate_timeout = 0 sets the time-out duration of a single request. This option may be useful for the 'max _ execution_time 'in php. ini settings because of some special reasons. If it is set to '0', it indicates 'off'. you can try to change this option when a 502 error occurs frequently.
Request_slowlog_timeout = 10 s when a request times out, the corresponding PHP call stack information is completely written to the slow log. Set to '0' to 'off'
Slowlog = log/$ pool. log. slow Request Logging, used with request_slowlog_timeout
Rlimit_files = 1024 set the rlimit limit for the file opening descriptor. Default value: System defined value. by default, the system can open a 1024 handle, which can be viewed using ulimit-n, and modified using ulimit-n 2048.
Rlimit_core = 0 sets the maximum limit value of the core rlimit. Available values: 'limited', 0, or positive integer. Default value: System defined value.
Chroot = the Chroot directory at startup. The defined directory must be an absolute path. If not set, chroot is not used.
Chdir = sets the Startup directory, which is automatically Chdir to when started. The defined directory must be an absolute path. Default value: current directory, or/Directory (for chroot)
Catch_workers_output = yes redirects stdout and stderr during running to the main error log file. If not set, stdout and stderr will be redirected to/dev/null according to FastCGI rules. Default value: Null. |