1.5-PHP-FPM configuration file

Source: Internet
Author: User
Tags php software
/usr/local/php/etc/php-fpm.conf is the configuration of the PHP service

/usr/local/php/etc/php.ini is the global configuration of the PHP software. For example: Clock


The main configuration is the PHP service configuration, the service template is very messy, first empty, insert code

>/usr/local/php/etc/php-fpm.conf emptying files

Vim/usr/local/php/etc/php-fpm.conf actually delete the comment, that is, the following code

[Global]

PID =/usr/local/php/var/run/php-fpm.pid

Error_log =/usr/local/php/var/log/php-fpm.log

[WWW]

Listen =/tmp/php-fcgi.sock monitoring mode, generally sockte can be customized, automatically generated

user = PHP-FPM

Group = PHP-FPM

PM = dynamic, manage the following code

Pm.max_children = 50 Maximum of 50 sub-processes

Pm.start_servers = 201 Starts 20 sub-subprocess, starting PHP starts 20 processes

Pm.min_spare_servers = 5 least kid Process 5

Pm.max_spare_servers = 35 Maximum of 35 child processes

pm.max_requests = 5,001 Sub-processes in its life cycle, processing 500 requests altogether. Automatic destruction

Rlimit_files = 1024 Each process, it uses the limit of the file descriptor, the big point also does not matter

Slowlog =/tmp/www_slow.log Tracking site to troubleshoot slow logs

Request_slowlog_timeout = 1 Script timed out 1 seconds, recorded in Slow.log of the previous path

php_admin_value[open_basedir]=/data/www/:/tmp/specify a directory to which PHP has permissions

The code is divided into two parts

1.global global configuration, mainly PID and error logs

2.www for service configuration,

If the configuration in PM = static then only Pm.max_children = 50 effective, that is, the start of 50 processes, others do not take effect.

It is recommended that you start with dynamic and start with 20 pool, and if idle, destroy each one, until the minimum is 5.


Multiple pool configurations with different domain names, corresponding to different pool. There are 2 benefits, 1 can be assigned different permissions for different sites 21 sites hanging off, does not affect other pool sites.

[Global]

PID =/usr/local/php/var/run/php-fpm.pid

Error_log =/usr/local/php/var/log/php-fpm.log

[WWW]

Listen =/tmp/www.sock

user = PHP-FPM

Group = PHP-FPM

PM = dynamic

Pm.max_children = 50

Pm.start_servers = 20

Pm.min_spare_servers = 5

Pm.max_spare_servers = 35

Pm.max_requests = 500

Rlimit_files = 1024

Slowlog =/tmp/www_slow.log

Request_slowlog_timeout = 1

[WWW1] Changes 1

Listen =/tmp/www1.sock Change 2

user = PHP-FPM

Group = PHP-FPM

PM = dynamic

Pm.max_children = 50

Pm.start_servers = 20

Pm.min_spare_servers = 5

Pm.max_spare_servers = 35

Pm.max_requests = 500

Rlimit_files = 1024

Slowlog =/tmp/www1_slow.log

Request_slowlog_timeout = 1



After-Class answers:

1: There are two questions 1 This listen =/tmp/php-fcgi.sock when to write sock when to use 127.0.0.1:9000?

2 PHP-FMP inside Php_admin_value[open_basedir] =/data/www/and Nginx inside the virtual host configuration file Root/data/aaa if the two are configured at the same time the directory will take effect?

Answer: 1. Listen you are willing to use whichever, is similar, but some people think the socket performance is more efficient than the Ip:port form, in my opinion is similar.

2. Nginx configuration is just a Web site root directory, and PHP inside the Open_basedir is limited to PHP, you set it up, found that your site can not run at all.


2:PHP-FPM set up multiple pools, if you need to specify a different user per pool, then the user is in the PHP compile installation here--with-fpm-user=php-fpm how to bind multiple users?

Answer: The above is the default, we can also define additional in the configuration file.


3: Can't understand what a socket is

A: is used to communicate the file, similar to the TCP/IP communication mechanism, this file is unique within the unix/linux system. Like MySQL data communication, we can use the socket file to communicate.

  • 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.