Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of php-fpm configuration File

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail the example analysis of the php-fpm configuration file. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

/ 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 php software. Such as: clock

The main configuration is the configuration of the php service. The self-contained service template is very messy. First, empty and insert the code.

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

Vim / usr/local/php/etc/php-fpm.conf actually removes the comments, which 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 snooping method. Generally, sockte can be customized and automatically generated

User = php-fpm

Group = php-fpm

Pm = dynamic dynamic, manage the following code

Pm.max_children = 50 maximum of 50 child processes

Pm.start_servers = 20 start 20 child processes, that is, start 20 processes when you start php

Pm.min_spare_servers = 5 minimum process 5

Pm.max_spare_servers = 35 up to 35 child processes

Pm.max_requests = 500A child process processes a total of 500 requests in its lifetime. Automatic destruction

Rlimit_files = 1024 for each process, it doesn't matter if it uses a large number of file descriptors.

Slowlog = / tmp/www_slow.log tracks the website, troubleshooting the slow logs of the website

Request_slowlog_timeout = 1 script timed out for 1 second and recorded in the slow.log of the previous path

Php_admin_ value [open _ basedir] = / data/www/:/tmp/ specifies the directory where php has permission

The code is divided into two parts

1.global global configuration, mainly pid and error log

2.www configures for services

If pm = static in the configuration, then only pm.max_children = 50 will take effect, that is, 50 processes will be started, and nothing else will take effect.

It is recommended that you use dynamic to start 20 pool, and if you are idle, destroy them one by one until a minimum of 5.

Multiple pool are configured with different domain names, corresponding to different pool. There are two advantages, 1 can give different permissions to different sites 2 a site to hang up, 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] change 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

This is the end of this article on "sample analysis of php-fpm configuration files". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report