Home > Backend Development > PHP Tutorial > Detailed explanation of php-fpm configuration_PHP tutorial

Detailed explanation of php-fpm configuration_PHP tutorial

WBOY
Release: 2016-07-13 10:39:01
Original
776 people have browsed it

php5.3 comes with php-fpm

Copy the code The code is as follows:

/usr/local/php/ etc/php-fpm.conf

pid = run/php-fpm.pid
pid setting, the default is var/run/php-fpm.pid in the installation directory, it is recommended to turn it on

error_log = log/php-fpm.log
Error log, the default is var/log/php-fpm.log

in the installation directory

log_level = notice
Error level. Available levels are: alert (must be processed immediately), error (error situation), warning (warning situation), notice (general important information), debug (debugging information). Default: notice.

emergency_restart_threshold = 60
emergency_restart_interval = 60s
Indicates that if the number of php-cgi processes that have SIGSEGV or SIGBUS errors within the emergency_restart_interval value exceeds emergency_restart_threshold, php-fpm will restart gracefully. These two options generally remain at their default values.

process_control_timeout = 0
Set the timeout for the child process to accept the reuse signal of the main process. Available units: s (seconds), m (minutes), h (hours), or d (days) Default unit: s ( seconds). Default: 0.

daemonize = yes
Execute fpm in the background. The default value is yes. It can be changed to no for debugging.

In FPM, it is possible to run multiple process pools with different settings. These settings can be set individually for each process pool.

listen = 127.0.0.1:9000
fpm listening port, which is the address processed by php in nginx. Generally, the default value is sufficient.
The available formats are: ‘ip:port’, ‘port’, ‘/path/to/unix/socket’. Each process pool needs to be set.

listen.backlog = -1
Number of backlogs, -1 means unlimited, determined by the operating system, just comment out this line.

listen.allowed_clients = 127.0.0.1
Allow access to the IP of the FastCGI process. Set any to unrestricted IP. If you want to set nginx on other hosts to also access this FPM process, the listen must be set to be locally accessible. Accessed IP. The default value is any.
Each address is separated by a comma. If not set or empty, any server requesting a connection is allowed

listen.owner = www
listen.group = www
listen.mode = 0666
unix socket setting options. If you use tcp to access, just comment here.

user = www
group = www
The account and group that started the process

pm = dynamic
How to control the child process, the options are static and dynamic.
If static is selected, the fixed number of child processes is specified by pm.max_children.
If dynamic is selected, it is determined by the following parameters:
pm.max_children, the maximum number of child processes
pm.start_servers, the number of processes at startup
pm.min_spare_servers, to ensure the minimum number of idle processes , if the idle process is less than this value, create a new child process
pm.max_spare_servers to ensure the maximum number of idle processes. If the idle process is greater than this value, clean it up
For dedicated servers, pm can be set to static .

pm.max_requests = 1000
Set the number of requests served before each child process is reborn. Very useful for third-party modules that may have memory leaks. If set to '0', requests will always be accepted. Equivalent Based on the PHP_FCGI_MAX_REQUESTS environment variable. Default value: 0.

pm.status_path = /status
The URL of the FPM status page. If not set, the status page cannot be accessed. Default value: none.

ping.path = /ping
The ping URL of the FPM monitoring page. If not set, the ping page cannot be accessed. This page is used to externally detect whether the FPM is alive and can respond to requests. Please note that it must start with a slash (/).

ping.response = pong
is used to define the return response of the ping request. The returned text/plain format text is HTTP 200. Default value: pong.

request_terminate_timeout = 0
Set the timeout for a single request. This option may be useful if the 'max_execution_time' in the php.ini setting does not terminate the running script for some special reason. Setting it to '0' means ' Off'.
You can try changing this option when 502 errors occur frequently.

request_slowlog_timeout = 10s
When a request sets the timeout period, the corresponding PHP call stack information will be completely written to the slow log. Setting it to '0' means 'Off'

slowlog = log/$pool.log.slow
Logging of slow requests, used in conjunction with request_slowlog_timeout

rlimit_files = 1024
Set the rlimit limit of the file open descriptor. Default value: system-defined value
The system default open handle is 1024, which can be viewed using ulimit -n and modified with ulimit -n 2048.

rlimit_core = 0
Set the maximum limit value of core rlimit. Available values: ‘unlimited’, 0 or positive integer. Default value: system-defined value.

chroot =
Chroot directory at startup. The defined directory needs to be an absolute path. If not set, chroot will not be used.

chdir =
Set the startup directory. Chdir will be automatically moved to this directory during startup. The defined directory needs to be an absolute path. Default value: current directory, or / directory (when chrooting)

catch_workers_output = yes
Redirect stdout and stderr during the running process to the main error log file. If not set, stdout and stderr will be redirected to /dev/null according to FastCGI rules. Default value : Empty.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/733409.htmlTechArticlephp5.3 comes with php-fpm. Copy the code as follows: /usr/local/php/etc/php- fpm.conf pid = run/php-fpm.pid pid setting, the default is var/run/php-fpm.pid in the installation directory. It is recommended to enable error...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template