/Etc/php-fpm.d/www. conf configuration notes, php-fpm.dwww.conf

Source: Internet
Author: User
Tags stop script connection reset

/Etc/php-fpm.d/www. conf configuration notes, php-fpm.dwww.conf

1. The rlimit_files value in the php-fpm configuration file must be consistent with the number of open connections of the system.

1) view the number of opened system files

[Root @ iZ94eveq0q4Z ~] # Ulimit-n
65535

2) Check the rlimit_files value in the php-fpm configuration file.

; Set open file descriptor rlimit # rlimit sets the open file descriptor
; Default Value: system defined value
Rlimit_files = 65535
If the two values are different, set them to the same

The method is as follows:

3) set the number of open files in the system

[Root @ hotdata ~] # Ulimit-HSn 65535
[Root @ hotdata ~] # Ulimit-n
65535
[Root @ hotdata ~] #

Restart the php-fpm service after setting.

2. Set request_terminate_timeout = 0 to 0.

; The timeout for serving a single request after which the worker process will
; Be killed. This option shocould be used when the 'max _ execution_time 'ini option
; Does not 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: 0
Request_terminate_timeout = 0

Because this parameter will directly kill the php process and restart the php process, the front-end nginx will return 104: Connection reset by peer. This process is very slow. The general feeling is that the website is very slow.

Nginx may have 502
Recv () failed (104: Connection reset by peer) while reading response header from upstream

3. Do not enable the request_slowlog_timeout configuration.

Previously, this parameter was set on the server as follows:

Request_slowlog_timeout = 10 causes image processing to fail at a time, with a 502 error each time.

The error message is as follows:

Nginx error message:
16:20:23 [error] 649 #0: * 9862 recv () failed (104: Connection reset by peer) while reading response header from upstream, client: 163.177.69.13,

The error message for php-fpm is:

[28-Dec-2015 17:04:01] WARNING: [pool www] child 10520, script'/hotdata/kehu/foshang_niufeecms/index. php '(request: "GET/index. php ") execution timed out (10.451550 sec), terminating
[28-Dec-2015 17:04:01] WARNING: [pool www] child 10512, script'/hotdata/kehu/foshang_niufeecms/index. php '(request: "GET/index. php ") execution timed out (12.396650 sec), terminating
[28-Dec-2015 17:04:01] WARNING: [pool www] child 10520 exited on signal 15 (SIGTERM) after 73.413706 seconds from start
[28-Dec-2015 17:04:01] NOTICE: [pool www] child 10909 started
[28-Dec-2015 17:04:01] WARNING: [pool www] child 10512 exited on signal 15 (SIGTERM) after 73.421170 seconds from start
[28-Dec-2015 17:04:01] NOTICE: [pool www] child 10910 started/var/log/php-fpm/www-slow.log record as follows

[28-Dec-2015 16:23:17] [pool www] pid 2427
Script_filename =/hotdata/kehu/foshang_niufeecms/index. php
[0x00007f94070ff668] file_get_contents ()/hotdata/kehu/foshang_niufeecms/index/Lib/Action/MemberAction. class. php: 516
[0x00007f94070ff140] makecar ()/hotdata/kehu/foshang_niufeecms/index/Lib/Action/MemberAction. class. php: 623
[0x00007fff6b5bd870] ajaxMakeCart () unknown: 0
[0x00007f94070fde48] invoke ()/hotdata/kehu/foshang_niufeecms/core/Lib/Core/App. class. php: 171
[0x00007f94070fdc70] exec ()/hotdata/kehu/foshang_niufeecms/core/Lib/Core/App. class. php: 207
[0x00007f94070fda98] run ()/hotdata/kehu/foshang_niufeecms/core/Lib/Core/Think. class. php: 39
[0x00007f94070fc610] start ()/hotdata/kehu/foshang_niufeecms/core/Common/runtime. php: 242
[0x00007f94070fbef8] ++ dump failed

Therefore, it is best to disable this setting.
; Request_slowlog_timeout = 10

The above/etc/php-fpm.d/www. conf configuration notes is small make up to share with you all the content, hope to give you a reference, also hope you can support a lot of help home.

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.