Apache 2.4 和 PHP-FPM 超时,原因是我找不到某些东西

Apache 2.4 和 PHP-FPM 超时,原因是我找不到某些东西

因此,我想找到使用 PHP-FPM 的 Apache 2.4 服务器上不断出现超时的原因。错误如下:

[proxy_fcgi:error] [pid ###] (70007)The timeout 
specified has expired:[client XXXXXXXX] AH01075 : 
Error dispatching request to:, referer: http://address

在以下配置文件中,我尝试了显示的每个超时。我在 fpm 中有两个池:

[www]
;user and group info and listening ip and such up here
access_log = /path/to/access.log
request_terminate_timeout = 15
php_admin_value[error_log] = /path/to/error.log
php_admin_flag[log_errors] = on

第二:

[app]
;user and group info and listening ip and such up here
access_log = /path/to/access.log
request_terminate_timeout = 300
php_admin_value[error_log] = /path/to/error.log
php_admin_flag[log_errors] = on

和我的php.ini:

max_execution_time = 300
max_input_time = 300
default_socket_timeout = 300

那么我的 Apache 配置是:

Timeout 80 
<FilesMatch "^(some | names | of | files)\.php$">
    SetHandler "proxy:fcgi://123.45.5.67:7891"
</FilesMatch>

<FilesMatch "^!(some | names | of | files)\.php$">
    SetHandler "proxy:fcgi://123.45.5.67:5432"
</FilesMatch>

显然,httpd.conf 中还有更多内容,但没有指定超时(除了将不相关的 ProxyPass 设置为 300 秒)。我读过这个帖子:https://unix.stackexchange.com/questions/270655/how-to-find-and-edit-apache-timeout,但我已使用 测试了我们的补丁rpm -q --changelog httpd | less,并且有一个针对该错误的补丁。当我只有一个池时,超时也会更加混乱。从 24 秒到 6.7 分钟不等(上传速度限制为 5Kb/s;不是代码问题,是故意测试的)。有一段时间它似乎与 有关联request_terminate_timeout,但这种关联消失了。

谢谢你的帮助。

答案1

所以,事实证明这与油门速度有关。油门速度太低,导致请求超时。我通过更改 RequestReadTimeout 解决了这个问题:

RequestReadTimeout header=20-120,MinRate=50 body=20,MinRate=50

请注意,如果用户的流量在到达您的服务器之前要经过代理或防火墙,这也很有用。请求和数据之间的时间可能很长。

相关内容