AH01075: Error dispatching request to

AH01075: Error dispatching request to

[proxy_fcgi:error] [pid 10550:tid 139819984324352] [client 108.162.215.94:42834] AH01067: Failed to read FastCGI header
[proxy_fcgi:error] [pid 10550:tid 139819984324352] (104)Connection reset by peer: [client 108.162.215.94:42834] AH01075: Error dispatching request to :
[proxy_fcgi:error] [pid 10761:tid 139819883611904] [client 108.162.215.110:43318] AH01067: Failed to read FastCGI header
[proxy_fcgi:error] [pid 10761:tid 139819883611904] (104)Connection reset by peer: [client 108.162.215.110:43318] AH01075: Error dispatching request to :
[proxy_fcgi:error] [pid 20213:tid 139819975931648] [client 172.69.35.77:20770] AH01067: Failed to read FastCGI header
[proxy_fcgi:error] [pid 20213:tid 139819975931648] (104)Connection reset by peer: [client 172.69.35.77:20770] AH01075: Error dispatching request to :
[proxy_fcgi:error] [pid 10550:tid 139819875219200] [client 172.69.35.77:20664] AH01067: Failed to read FastCGI header
[proxy_fcgi:error] [pid 10550:tid 139819875219200] (104)Connection reset by peer: [client 172.69.35.77:20664] AH01075: Error dispatching request to :

我遇到了同样的问题,原来Apache有处理超时的模块,称为mod_reqtimeout

默认值(您不会在默认的http.conf中看到它)是:

RequestReadTimeout handshake=0 header=20-40,MinRate=500 body=20,MinRate=500

在我的情况下,我是通过纯HTML表单提交上传文件的,因此该文件从技术上讲是标题的一部分,并且默认配置显示标题将在20到40秒时超时。20-40非常酷,因为它将在20秒后超时,但是如果在一秒钟内发送500字节,它将增加另外一秒的等待时间,直到达到40秒,然后无论如何超时。

我在网站上上传了较大的文件,因此将以下行添加到了httpd.conf文件中:

RequestReadTimeout handshake=0 header=20-600,MinRate=500 body=20,MinRate=500

因此,只要我的用户以至少500字节/秒的速度发送数据,请求就不会超时,直到达到最大值。达到600秒(最好阅读文档,不要在吞吐率上引用我)

它实际上是一个非常酷的Apache模块,但并不是超级知名,因为人们建议在其他类似的“指定的超时时间已到期:”中更改其他apache超时设置。问题与PHP-FPM有关,但是任何花费40以上的帖子都会发生此问题在Apache中默认提交的秒数。

---------------------------------------------------------------------------------------------------

您的PHP代码似乎比配置的超时时间要长。当apache使用fcgi加载PHP页面时,它将请求发送到PHP-FPM服务进行处理。如果PHP-FPM需要很长时间才能响应,那么您将看到这种类型的超时。可能的原因是您的PHP代码可能陷入了循环或等待耗时特别长的数据库的响应。

为了排除故障,我将使用CLI的php版本来查看脚本是否在合理的时间内完成($ time php /path/to/file.php)。PHP-FPM日志中可能包含其他信息(默认值:/var/log/php-fpm.log)。

--------------------------------------------------------------------------------------------------------------------------------------------------

我遇到了同样的问题,就我而言,此解决方案有效:

  • 增加request_terminate_timeout/etc/php-fpm.d/www.conf文件中的值 。

注意:此选项会覆盖php max_execution_time ini选项,并为其设置一个较低的值可能会给您带来很多麻烦,因为它会覆盖其他选项,并在超时到期时强制终止该请求。(如果您询问要设置哪个值;它应该是根据您的需要的最大脚本处理时间,但通常600s(10分钟)或10m(10分钟)要多得多。)

-----------------------------------------------------------------------------------------------------------------------------------------------------

-----

Apache 2.4.10
Ubuntu 14.04
PHP5-FPM: 5.5.9

-----

<IfModule mod_proxy.c>
  
  ProxyTimeout 900
  
  <Proxy fcgi://127.0.0.1:9000>
    ProxySet connectiontimeout=5 timeout=900 retry=3
  </Proxy>

</IfModule>

--

<VirtualHost *:443>

  ...

  ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/test/$1
  DirectoryIndex /index.php

</Virtualhost>
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值