Detailed configuration based on php fpm

  • 2020-06-03 06:03:53
  • OfStack

php - fpm php5. 3
pid = run/
pid Settings, default in the installation directory of var/run/ php-ES13en. pid, recommended to be turned on

error_log = log/php-fpm.log
Error log, var/log/ php-ES22en.log by default in the installation directory

log_level = notice
Error level. Available levels: alert (must be handled immediately), error (error condition), warning (warning condition), notice (1 General important information), debug (debug information). Default: notice.

emergency_restart_threshold = 60
emergency_restart_interval = 60s
php-fpm will restart gracefully if the number of ES45en-ES46en processes in emergency_restart_interval exceeds emergency_restart_threshold, indicating that SIGSEGV or SIGBUS error occurred in emergency_restart_interval. These two options 1 generally keep the default values.

process_control_timeout = 0
Sets the timeout for the child process to accept the multiplexed signal from the main process. Available in s(seconds), m(minutes), h(hours), or d(days). Default: 0.

daemonize = yes
fpm is executed in the background. The default value is yes, which can be changed to no for debugging purposes.

In FPM, you can use different Settings to run multiple process pools. These Settings can be set individually for each process pool.
listen =
fpm listens on the port, which is the address handled by php in nginx. 1 is generally the default value.
Available format is: 'ip: port', 'port', '/ path/to/unix/socket'. Each process pool needs to be set.

listen.backlog = -1
backlog number, -1 means unlimited, depending on the operating system, just comment out the line. backlog Reference:
listen.allowed_clients =
Allow access to IP of the FastCGI process, set any to not restrict IP, if you want to set other host nginx can also access the FPM process, listen should be set to cost accessible IP. The default is any.
Each address is separated by a comma. If not set or null, any server is allowed to request a connection

listen.owner = www = www
listen.mode = 0666
unix socket setting options, if accessed using tcp, just comment here.

user = www
group = www
Start the account and group for the process

pm = dynamic
The options for controlling child processes are static and dynamic.
If static is selected, a fixed number of child processes is specified by ES131en.max_ES133en.
If dynamic is selected, the following parameter determines:
pm.max_children, maximum number of child processes
pm.start_servers, number of processes at startup
pm.min_spare_servers, which guarantees a minimum number of free processes and creates a new child process if the free process is less than this value
pm_max_spare_servers, to ensure the maximum number of free processes, if the free process is greater than this value, this is cleaned up
For dedicated servers, pm can be set to static.

pm.max_requests = 1000
Set the number of requests to be served before each child process is regenerated. This is useful for 3rd party modules where there may be memory leaks. If set to '0 ', 1 is directly requested. This is equivalent to the PHP_FCGI_MAX_REQUESTS environment variable. Default: 0.

pm.status_path = /status
The address of the FPM status page. If not set, you cannot access the status page. Default: none.

ping.path = /ping
FPM monitors the ping url of the page. If not set, you cannot access the ping page. This page is used externally to check if FPM is alive and can respond to requests. Note that it must begin with a slash (/).

ping.response = pong
Used to define the return of ping requests. Returns text/plain format text as HTTP 200. Default: pong.

request_terminate_timeout = 0
Set the timeout timeout for a single request. This option may be useful for 'max_execution_time' in the ES192en.ini setting for scripts that did not abort for some special reason. Setting '0 'means' Off'.
You can try to change this option when 502 errors occur frequently.

request_slowlog_timeout = 10s
When the timeout for this setting is reached for 1 request, the corresponding PHP call stack information is written to the slow log in full. Set to '0 'for' Off'

slowlog = log/$pool.log.slow
Slow request logging in conjunction with request_slowlog_timeout

rlimit_files = 1024
Sets the rlimit limit for file open descriptor. Default: system defined value
The default openable handle of the system is 1024, which can be viewed by ulimit-ES219en and modified by ES220en-ES221en 2048.

rlimit_core = 0
Set the core rlimit maximum value. Available value: 'unlimited', 0 or positive integer. Default: system defined value.

chroot =
Chroot at startup. The defined directory needs to be the absolute path. If it is not set, chroot is not used.

chdir =
Set the boot directory to which Chdir will automatically boot. The defined directory needs to be an absolute path. Default: current directory, or/directory (at chroot)

catch_workers_output = yes
Redirects run stdout and stderr to the main error log file. If not set, stdout and stderr will be redirected to /dev/null according to the rules of FastCGI. Default: null.

Related articles: