apache proxy_fcgi -指定的超时已过期-调度请求时出错

p5cysglq  于 11个月前  发布在  Apache
关注(0)|答案(8)|浏览(195)

我有一个PHP应用程序,它返回我:

[Thu Oct 05 22:10:59.351244 2017] [proxy_fcgi:error] [pid 3733:tid 139869435164416] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:46777] AH01075: Error dispatching request to : (polling)
[Thu Oct 05 22:16:27.701213 2017] [proxy_fcgi:error] [pid 3732:tid 139869359630080] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:46988] AH01075: Error dispatching request to : (polling)
[Thu Oct 05 22:21:52.971235 2017] [proxy_fcgi:error] [pid 3733:tid 139869426771712] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:47055] AH01075: Error dispatching request to : (polling)
[Thu Oct 05 22:25:23.561216 2017] [proxy_fcgi:error] [pid 3732:tid 139869351237376] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:47115] AH01075: Error dispatching request to : (polling)
[Thu Oct 05 22:30:47.591237 2017] [proxy_fcgi:error] [pid 3733:tid 139869418379008] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:47321] AH01075: Error dispatching request to : (polling)
[Thu Oct 05 22:39:10.211214 2017] [proxy_fcgi:error] [pid 3733:tid 139869443557120] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:47407] AH01075: Error dispatching request to : (polling)
[Thu Oct 05 22:39:38.591259 2017] [proxy_fcgi:error] [pid 3733:tid 139869376415488] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:47412] AH01075: Error dispatching request to : (polling)
[Thu Oct 05 22:45:13.951238 2017] [proxy_fcgi:error] [pid 3733:tid 139869582505728] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:47615] AH01075: Error dispatching request to : (polling)
[Thu Oct 05 22:50:36.491214 2017] [proxy_fcgi:error] [pid 3732:tid 139869460342528] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:47668] AH01075: Error dispatching request to : (polling)
[Thu Oct 05 22:54:57.661219 2017] [proxy_fcgi:error] [pid 3733:tid 139869326059264] (70007)The timeout specified has expired: [client IPADDRESS HIDDEN:47726] AH01075: Error dispatching request to : (polling)

字符串
我认为上面的消息-在某种程度上-连接到以下随机错误:x1c 0d1x注意,XMLHttpRequests(AJAX调用)来自同一个域,有时不执行上面的错误。
这个消息来自哪个脚本,我该如何修复它?我能想到的只有一个脚本可能会超过默认的最大执行时间,但是这个脚本可以运行更长时间,在页面顶部使用ini_set来获得最大执行时间?
我不知道在哪里寻找和如何解决这个问题

pftdvrlh

pftdvrlh1#

<IfModule reqtimeout_module>

    # mod_reqtimeout limits the time waiting on the client to prevent an
    # attacker from causing a denial of service by opening many connections
    # but not sending requests. This file tries to give a sensible default
    # configuration, but it may be necessary to tune the timeout values to
    # the actual situation. Note that it is also possible to configure
    # mod_reqtimeout per virtual host.

    # Wait max 20 seconds for the first byte of the request line+headers
    # From then, require a minimum data rate of 500 bytes/s, but don't
    # wait longer than 40 seconds in total.
    # Note: Lower timeouts may make sense on non-ssl virtual hosts but can
    # cause problem with ssl enabled virtual hosts: This timeout includes
    # the time a browser may need to fetch the CRL for the certificate. If
    # the CRL server is not reachable, it may take more than 10 seconds
    # until the browser gives up.
    RequestReadTimeout header=20-40,minrate=500

    # Wait max 10 seconds for the first byte of the request body (if any)
    # From then, require a minimum data rate of 500 bytes/s
    RequestReadTimeout body=10,minrate=500

</IfModule>

字符串
以上似乎是Debian的默认值-在我的例子中,我只需要修改这些值来增加假定的超时。

jrcvhitl

jrcvhitl2#

最后我解决了这个问题。
在增加代理服务器后,我开始得到这个错误。在我的情况下,问题是在WAF(Web应用程序防火墙)配置中。查看access.log(或your_virtual_host.access.log),我意识到所有的源IP都是伪装成防火墙IP的,而不是来自互联网的真正IP源。更改此配置Apache日志开始知道真正的源IP,问题得到解决。

23c0lvtd

23c0lvtd3#

我正在使用apache2,看到有0超时,所以改变300作为每一个建议,我们需要的。
300美元
但这是不可用的。Proxyv600

8nuwlpux

8nuwlpux4#

将以下行添加到httpd.confapache2.conf(取决于您的系统)文件中:

Timeout 600
ProxyTimeout 600

字符串
重新启动Apache

sudo /etc/init.d/apache2 restart

siv3szwd

siv3szwd5#

我知道这个问题是旧的,但我有这个问题与WordPress的同时做多个职位删除,我发现很难找到一个解决方案,所以我把这个为我(在未来)尽可能多的其他人有同样的问题。
对于CentOS 8,请确保已安装快速CGI和可选的php-fph

yum install mod_fcgid php-fpm

字符串
如果没有php-fpm编辑:

vi  /etc/httpd/conf.d/fcgid.conf


添加线

FcgidIdleTimeout 1200
FcgidProcessLifeTime 1200
FcgidConnectTimeout 1200
FcgidIOTimeout 1200


如果安装了php-fpm,编辑/创建:

vi /etc/httpd/conf.modules.d/00-proxy_timeout.conf


并添加行

Timeout 1200
ProxyTimeout 1200


重启php-fpm - if installed和httpd

wnavrhmk

wnavrhmk6#

您可以将timeout=添加到ProxyPassMatch
ProxyPassMatch ^/(.+\.php.*)$ fcgi://127.0.0.1:9000/<docroot>/$1 timeout=1800
看看here .希望这会有帮助。

cx6n0qe3

cx6n0qe37#

这可能会帮助其他人。
如果你使用的是Centos 8,我发现下面的代码可以解决这个问题--在你的php.conf中,在调用SetView的地方附近,添加以下内容:

<IfModule !mod_php5.c>
  <IfModule !mod_php7.c>
    # Enable http authorization headers
    SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1

    <FilesMatch \.(php|phar)$>
        SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
    </FilesMatch>
  </IfModule>
</IfModule>

<Proxy "unix:/run/php-fpm/www.sock|fcgi://localhost">
    ProxySet connectiontimeout=600 TimeOut=600
</Proxy>

字符串

ffx8fchx

ffx8fchx8#

我不确定这个错误,但很可能你的PHP代码应用程序花费的时间比配置的时间长。我建议使用PHP的CLI版本来解决这个问题。
我可以肯定地说,你的代码卡在一些循环中,尝试使用CLI版本的PHP,它肯定会有所帮助。

相关问题