study forty-eight

12.21 php-fpm pool
12.22 php-fpm slow execution log
12.23 open_basedir
12.24 php-fpm process management

php-fpm pool

vim /usr/local/php/etc/php-fpm.conf //Add
include = etc/php-fpm.d/*.conf
study forty-eight
mkdir /usr/local/php-fpm/etc/php-fpm.d/
cd /usr/local/php-fpm in the [global] section /etc/php-fpm.d/vim
www.conf //The content is as follows
[www]
listen = /tmp/www.sock
listen.mode=666
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

Continue to edit the configuration file
vim aming.conf //The content is as follows
[aming]
listen = /tmp/aming.sock
listen.mode=666
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
/usr/local/php/sbin/php-fpm -t
/etc/init.d/php-fpm restart

ps aux |grep php-fpm
cd /usr/local/nginx/conf/vhost

php-fpm slow execution log

vim /usr/local/php/etc/php-fpm.d/www.conf//Add the following content
request_slowlog_timeout = 1
slowlog = /usr/local/php/var/log/www-slow.log
configure the virtual host of nginx test.com.conf, change unix:/tmp/php-fcgi.sock to unix:/tmp/www.sock
and reload the nginx service
vim /data/wwwroot/test.com/sleep.php// and write the following content
<?php echo "test slow log";sleep(2);echo "done";?>
curl -x127.0.0.1:80 test.com/sleep.php
cat /usr/local/php-fpm/var/ log/www-slow.log

open_basedir

vim /usr/local/php-fpm/etc/php-fpm.d/aming.conf//Add the following content
php_admin_value[open_basedir]=/data/wwwroot/aming.com:/tmp/
Create a test php script for testing
Change aming.conf again, modify the path, test the
configuration error log
again , and test the
error log again

php-fpm process management

pm = dynamic //Dynamic process management, or static
pm.max_children = 50 //Maximum number of child processes, ps aux can view
pm.start_servers = 20 //Number of processes that will be started when the service is started
pm.min_spare_servers = 5 / /Defines the minimum number of child processes during the idle period. If this value is reached, the php-fpm service will automatically fork new child processes.
pm.max_spare_servers = 35 //Defined in the idle period, the maximum number of child processes, if it is higher than this value, it will start to clean up the idle child processes.
pm.max_requests = 500 //Define the maximum number of requests a child process can handle, that is to say, a php-fpm child process can handle so many requests at most. When this value is reached, it will automatically exit![]

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325166637&siteId=291194637