PHP-FPM Configuration

Source: Internet
Author: User
Tags fpm response code stop script

; Start a new pool named ' www '.; The variable $pool can we used in any directive and would be a replaced by the; Pool name (' www ' here) [www]; Per pool prefix; It only applies on the following directives:; -' slowlog '; -' Listen ' (unixsocket); -' chroot '; -' chdir '; -' php_values '; -' php_admin_values '; When not set, the global prefix (or @[email protected]) applies instead.; Note:this directive can also is relative to the global prefix.; Default value:none;prefix =/path/to/pools/$pool; Unix User/group of processes; Note:the user is mandatory.       If The group is not set, the default user ' s group; would be used.; Rpm:apache user chosen to provide access to the same directories as Httpduser = Apache; Rpm:keep a group allowed to write in log dir.group = Apache; The address on which to accept FastCGI requests.;   Valid syntaxes is:;                            ' Ip.add.re.ss:port '-to listen in a TCP socket to a specific IPv4 address on;   a specific port;; ' [ip:6:addr:ess]:p orT '-to listen in a TCP socket to a specific IPv6 address on;   a specific port;;                            ' Port '-to listen in a TCP socket to all IPV4 addresses on A;   Specific port;                            ' [::]:p ort '-to listen in a TCP socket to all addresses;   (IPv6 and ipv4-mapped) on a specific port;; '/path/to/unix/socket '-to listen on a UNIX socket.; Note:this value is Mandatory.listen = 127.0.0.1:9000; Set Listen (2) backlog.; Default Value:65535;listen.backlog = 65535; Set Permissions for UNIX sockets, if one is used. In Linux, Read/write; Permissions must is set in order to allow connections from a Web server.;                 Default Values:user and group are set as the running user; Mode is set to 0660;listen.owner = Nobody;listen.group = Nobody;listen.mode = 0660; When POSIX Access Control Lists is 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 = Apache,nginx;listen.acl_groups =; List of Addresses (Ipv4/ipv6) of FastCGI clients which is allowed to connect.; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original; PHP FCGI (5.2.2+). Makes sense is only with a TCP listening socket. each address; Must is separated by a comma. If This value is the left blank, connections'll be; Accepted from any IP address.; Default Value:anylisten.allowed_clients = 127.0.0.1; Specify the Nice (2) priority to apply to the pool processes (only if set); The value can vary from-19 (highest) to (lower);       Note:-It would work if the FPM master process is launched as root;         -The pool processes would inherit the master process priority; unless it specified otherwise; Default Value:no set; process.priority =-19; Choose How the Process manager would control the number of child processes.   Possible Values:; Static-a Fixed number (Pm.max_children) of the child processes;             Dynamic-the number of child processes is set dynamically based on the; Following directives.             With this process management, there'll be;             Always at least 1 children.;                                    Pm.max_children-the Maximum number of children that can;             Be alive at the same time.;             Pm.start_servers-the number of children created on startup.;                                    Pm.min_spare_servers-the minimum number of children in ' idle '; State (waiting to process).                                    If the number;                                    of ' idle ' processes is less than this;             Number then some children would be created.;                                    Pm.max_spare_servers-the Maximum number of children in ' idle '; State (waiting to process).                                    If the number;         of ' idle ' processes is greater than this;                           Number then some children would be killed.; Ondemand-no Children is created at startup.             Children is forked when; New requests would connect.             The following parameter is used:;                                         Pm.max_children-the Maximum number of children that;             Can be alive at the same time.;                                         Pm.process_idle_timeout-the number of seconds after which; An idle process would be killed.; Note:this value is mandatory.pm = dynamic; The number of child processes to being created when PM was set to ' static ' and the; Maximum number of processes when PM was set to ' dynamic ' or ' OnDemand '.; This value sets the limit on the number of simultaneous requests. Served. Equivalent to the apachemaxclients directive with mpm_prefork.; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP; Cgi. The below defaults is based on a server withOut much resources. Don ' t; Forget to tweak pm.* to fit your needs.; note:used when PM was set to ' static ', ' dynamic ' or ' OnDemand '; Note:this value is Mandatory.pm.max_children = 500; The number of child processes created on startup.; Note:used only if PM is set to ' dynamic '; Default value:min_spare_servers + (max_spare_servers-min_spare_servers)/2pm.start_servers = 100; The desired minimum number of idle server processes.; Note:used only if PM is set to ' dynamic '; Note:mandatory when PM was set to ' dynamic ' pm.min_spare_servers = 100; The desired maximum number of idle server processes.; Note:used only if PM is set to ' dynamic '; Note:mandatory when PM was set to ' dynamic ' pm.max_spare_servers = 200; The number of seconds after which an idle process would be killed.; Note:used only if PM is set to ' OnDemand '; Default value:10s;pm.process_idle_timeout = 10s;; The number of requests each child process should execute before respawning.; This can is useful to work around MEmory leaks in 3rd party libraries. for; Endless request processing Specify ' 0 '. equivalent to php_fcgi_max_requests.; Default value:0pm.max_requests = 5000; The URI to view the FPM status page. If This value was not set, no URI would be; Recognized as a status page.   It shows the following informations:;   Pool-the name of the pool;;   Process manager-static, dynamic or ondemand;;   Start time-the date and time FPM has started;;   Start since-number of seconds since FPM has started;;   Accepted conn-the number of request accepted by the pool;                          Listen queue-the number of request in the queue of pending;   Connections (see Backlog in Listen (2));;                          Max Listen queue-the Maximum number of requests in the queue;   of pending connections since FPM has started;;   Listen queue len-the size of the socket queue of pending connections; Idle processes-the number of idle processes;;   Active processes-the number of active processes;;   Total processes-the Number of idle + active processes;;                          Max Active Processes-the maximum number of active processes since FPM;   has started;;                          Max children Reached-number of times, the process limit has been reached,;                          When PM tries to start more children (works only for; PM ' dynamic ' and ' OnDemand ');; Value is updated in real time.;   Example output:;   pool:www;   Process manager:static;   Start time:01/jul/2011:17:53:49 +0200;   Start since:62636;   Accepted conn:190460;   Listen queue:0;   Max Listen queue:1;   Listen queue len:42;   Idle processes:4;   Active processes:11;   Total processes:15;   Max Active processes:12; Max children reached:0;; By default the Status page output is formatted as Text/plain. passing either; ' HTML ', ' xml ' or ' JSON ' in the query string would return the corresponding; Output syntax.   Example:;   Http://www.foo.bar/status;   Http://www.foo.bar/status?json;   http://www.foo.bar/status?html; Http://www.foo.bar/status?xml;; By default the status page is outputs short status. Passing ' full ' in the; Query string would also return status for each pool process.;   Example:;   Http://www.foo.bar/status?full;   http://www.foo.bar/status?json&full;   http://www.foo.bar/status?html&full; http://www.foo.bar/status?xml&full;   The full status returns for each process:;   Pid-the PID of the process;;   State-the State of the process (Idle, Running, ...);;   Start Time-the Date and time the process has started;;   Start since-the number of seconds since the process has started;;   Requests-the number of requests the process has served;;   Request Duration-the duration inμs of the requests; Request metHod-the Request Method (GET, POST, ...);   Request Uri-the request URI with the query string;;   Content length-the Content Length of the request (only with POST);;   User-the User (Php_auth_user) (or '-' if not set);;   Script-the main script called (or '-' if not set);;                          Last Request Cpu-the%cpu, the last request consumed;                          It's always 0 if the process was not in Idle state;                          Because CPU calculation is do when the request;   processing has terminated;;                          Last request memory-the max amount of memory the last request consumed;                          It's always 0 if the process was not in Idle state;                          Because memory calculation is do when the request; processing has terminated;; If the process is in an Idle state and then informations was related to the; Last request, the process has served. OtherwisE informations is related to; The current request being served.;   Example output:;   ************************;   pid:31330;   state:running;   Start time:01/jul/2011:17:53:49 +0200;   Start since:63087;   requests:12808;   Request duration:1250261;   Request Method:get; Request URI:/test_mem.php?   n=10000;   Content length:0;   User:-;   Script:/home/fat/web/docs/php/test_mem.php;   Last Request cpu:0.00; Last request memory:0;;       Note:there is a real-time FPM status Monitoring sample Web page available; It ' s available in: @[email protected]/fpm/status.html;; Note:the value must start with a leading slash (/).       The value can be;       Anything, but it may is a good idea to use the. php extension or it; May conflict with a real PHP file.; Default Value:not set;pm.status_path =/status; The ping URI to the monitoring page ofFpm. If This value was not set, no; URI would be recognized as a ping page. This could is used to test from outside; That FPM was alive and responding, or to; -Create a graph of FPM availability (rrd or such);; -Remove a server from a group if it's not responding (load balancing);; -Trigger alerts for the operating team (24/7).; Note:the value must start with a leading slash (/).       The value can be;       Anything, but it may is a good idea to use the. php extension or it; May conflict with a real PHP file.; Default Value:not set;ping.path =/ping; This directive is used to customize the response of a ping request. the; Response is formatted as Text/plain with a response code.; Default value:pong;ping.response = Pong; The access log file; Default:not Set;access.log = log/$pool. Access.log; The access log format.;  The following syntax is allowed;  Percent: the '% ' character;      %c:%cpu used by the request;      It can accept the following format:; -%{user}c for user CPU only;      -%{system}c for system CPUs 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 is 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 is 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 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;; Default: "%R-%u%t \"%m%r\ "%s"; Access.format = "%R-%u%t \"%m%r%q%q\ "%s%f%{mili}d%{kilo}m%c%%"; The log file for slow requests; Default Value:not set; Note:slowlog is mandatory if request_slowlog_timeout is Setslowlog =/var/log/php-fpm/www-slow.log; The timeout for serving a single request after which a PHP backTrace would be; Dumped to the ' slowlog ' file. A value of ' 0s ' means ' off '.; Available units:s (econds) (default), M (inutes), H (ours), or D (ays); Default value:0request_slowlog_timeout = 2s; The timeout for serving a single request after which the worker process would; Be killed. This option should is used when the ' max_execution_time ' ini option; Does not a stop script execution for some reason. A value of ' 0 ' means ' off '.; Available units:s (econds) (default), M (inutes), H (ours), or D (ays); Default value:0request_terminate_timeout = 4s; Set Open file descriptor rlimit.; Default Value:system defined value;rlimit_files = 1024; Set Max core size rlimit.; Possible Values: ' Unlimited ' or an integer greater or equal to 0; Default Value:system defined value;rlimit_core = 0; Chroot to this directory at the start. This value must is defined as an; Absolute path. When the This value was not set, Chroot was not used.; Note:you can prefix with ' $prefix ' to chroot to the pool prefix or one; of its SubDirectories. If the pool prefix is not set, the global prefix; would be used instead.;       Note:chrooting is a great security feature and should be used whenever; Possible.       However, all PHP paths is relative to the chroot; (Error_log, Sessions.save_path, ...).; Default Value:not set;chroot =; Chdir to this directory at the start. Note:relative path can be used.; Default value:current directory Or/when chroot;chdir =/var/www; Redirect worker stdout and stderr into main error log. If not set, stdout and; StdErr'll be redirected to/dev/null according to FastCGI specs.; Note:on highloaded environement, this can cause some delay in the page; Process time (several MS).; Default value:no;catch_workers_output = yes; Clear environment in FPM workers; Prevents arbitrary environment variables from reaching FPM worker processes; By clearing the environment in workers before ENV VARs specified in this; Pool configuration is added.; Setting to "No" would make all environment variables available to PHP code; Via Getenv (), $_env and $_server.; Default value:yes;clear_env = no; Limits the extensions of the main script FPM would allow to parse. This can; Prevent configuration mistakes on the Web server side. You should only limit; FPM to. php extensions to prevent malicious users to use the other extensions to; Exectute PHP code.; Note:set a empty value to allow all extensions.; Default Value:. php;security.limit_extensions =. php. php3. php4. php5; Pass environment variables like Ld_library_path. All $VARIABLEs is taken from; The current environment.; Default Value:clean Env;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 is 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 ' is overwritten by; PHP call ' Ini_set '; For Php_*flag, valid values is on, off, 1, 0, True, false, yes or No.; Defining ' extension ' would load the corresponding GKFX extension from; Extension_dir. Defining ' disable_functions ' or ' disable_classes ' would not; Overwrite previously defined php.ini values, but would append the new value; instead.; Note:path INI options can be relative and'll be expanded with the prefix; (pool, global or @[email protected]);                Default value:nothing is defined by default except the values in php.ini and; Specified at startup with the-d Argument;php_admin_value[sendmail_path] =/usr/sbin/sendmail-t-i-f [email protect ED];p hp_flag[display_errors] = Offphp_admin_value[error_log] =/var/log/php-fpm/www-error.logphp_admin_flag[log_ Errors] = On;php_admin_value[memory_limit] = 128M; Set the following data paths to directories owned by the FPM process user.; Don't change the ownership of existing system directories, if the process; User does not has Write permission, create dedicated directories for this; Purpose.;; See warning about choosing the location of these directories on your system; at Http://php.net/session.save-pathphp_value[session.save_handler] = Filesphp_value[session.save_path] =/var/lib/ Php/sessionphp_value[soap.wsdl_cache_dir] =/var/lib/php/wsdlcache

PHP-FPM Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.