php-fpm配置:打开php-fpm的配置文件:/etc/php-fpm.conf
php-fpm配置:
1. 打开php-fpm的配置文件:/etc/php-fpm.conf
2. 修改php-fpm的运行用户和组:
user = www-data
group = www-data
3. 修改php-fpm的最大连接数:
pm.max_children = 50
4. 修改php-fpm的最大请求数:
pm.max_requests = 500
5. 修改php-fpm的超时时间:
request_terminate_timeout = 30s
6. 保存并重启php-fpm:
sudo systemctl restart php-fpm
以上就是php-fpm的常用配置,完整的php-fpm配置如下:
[global]
; Pid file
pid = run/php-fpm.pid
; Error log file
error_log = log/php-fpm.log
; Log level
log_level = warning
; The process manager configuration
[process]
; The number of child processes to be created when pm is set to 'static'
pm = dynamic
; The number of child processes created on startup
pm.start_servers = 4
; The desired minimum number of idle server processes
pm.min_spare_servers = 2
; The desired maximum number of idle server processes
pm.max_spare_servers = 6
; The number of seconds after which an idle process will be killed
pm.process_idle_timeout = 10s
; The number of requests each child process should execute before resing
pm.max_requests = 500
; The user and group settings for the processes
user = www-data
group = www-data
; The listen.owner and listen.group settings
listen.owner = www-data
listen.group = www-data
; Set permissions for unix socket, if one is used
;listen.mode = 0666
; When POSIX Access Control Lists are supported you can set them using
; these options, value is a comma separated list of user/group names.
; When set, listen.owner and listen.group are ignored
;listen.acl_users =
;listen.acl_groups =
; List of addresses on which to accept FastCGI requests
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php-fpm.sock
; Set listen(2) backlog
; Default Value: 65535 (-1 on FreeBSD and OpenBSD)
;listen.backlog = 65535
; Set permissions for unix socket, if one is used
; Default Values: user and group are set as the running user
; mode is set to 0666
listen.owner = www-data
listen.group = www-data
listen.mode = 0666
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = www-data
group = www-data
; Choose how the process manager will control the number of child processes.
; Possible Values:
; static - a fixed number (pm.max_children) of child processes;
; dynamic - the number of child processes are set dynamically based on the
; following directives. With this process management, there will be
; always at least 1
本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处
评论列表(40条)