Nginx

伺服器達到 max_children 設置的問題,考慮提高它

  • November 12, 2018

我最近將 30 個網站從舊伺服器遷移到新伺服器,現在在 nginx 上執行,就像以前在 apache 上執行一樣。

除 1 個網站外,所有網站都可以正常工作。

我不知道為什麼,但我在日誌文件**/var/log/php7.2-fpm-example.log**上收到這些消息:

[09-Nov-2018 14:58:35] NOTICE: systemd monitor interval set to 10000ms
[10-Nov-2018 03:35:51] WARNING: [pool cappatrimonial] server reached max_children setting (5), consider raising it
[10-Nov-2018 06:30:09] WARNING: [pool cappatrimonial] child 4727 exited on signal 7 (SIGBUS) after 10458.281970 seconds from start
[10-Nov-2018 06:30:09] NOTICE: [pool cappatrimonial] child 13790 started
[10-Nov-2018 09:35:35] NOTICE: Terminating ...
[10-Nov-2018 09:35:35] NOTICE: exiting, bye-bye!
[10-Nov-2018 09:35:37] NOTICE: fpm is running, pid 31266
[10-Nov-2018 09:35:37] NOTICE: ready to handle connections
[10-Nov-2018 09:35:37] NOTICE: systemd monitor interval set to 10000ms
[10-Nov-2018 10:39:56] WARNING: [pool cappatrimonial] server reached max_children setting (10), consider raising it

正如您在上面看到的,我已經將max_children 設置5增加到10,並且消息再次出現。此外,問題可能是每 3 小時或每 10 小時……沒有邏輯。

在 nginx 錯誤日誌文件**/var/log/nginx/example.error_log**我發現了這個:

2018/11/10 09:35:35 [error] 16088#16088: *77278 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: server_ip_address, server: www.example.com, request: "GET //erreur-404 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm-example.sock:", host: "www.example.com"

2018/11/10 09:35:35 [info] 16088#16088: *77280 client server_ip_address closed keepalive connection (104: Connection reset by peer)

怎麼了 ?

下面是我對這個網站的 php-fpm 配置:

[global]
pid = /var/run/php/php7.2-fpm-example.pid
error_log = /var/log/php7.2-fpm-example.log

[example]
user = example
group = example
listen = /var/run/php/php7.2-fpm-example.sock
listen.owner = www-data
listen.group = www-data
php_admin_value[disable_functions] = exec,passthru,shell_exec,system
pm = ondemand
pm.max_children = 10
pm.process_idle_timeout = 20s

我真的不明白為什麼這只出現在這個網站而不是其他網站。

你有什麼想法,因為我迷路了:-/?

非常感謝

問題是由於@Richard Smith 建議的錯誤 php 腳本

我已經更新了網站,現在工作正常。

謝謝

引用自:https://serverfault.com/questions/939441