AH01075: Error dispatching request to

AH01075: Error scheduling 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 :

I ran into the same problem, originally Apache had a module for handling timeouts called mod_reqTIMEOUT
The default value (which you won’t see in the default HTTp.conf) is:

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

In my case, I uploaded the file through a pure HTML form submission, so the file is technically part of the title, and the default configuration to display the title will time out between 20 and 40 seconds. 20-40 is cool because it will time out after 20 seconds, but if it sends 500 bytes in a second, it will increase the wait time by another second until it reaches 40 seconds, and then timeout anyway.
I uploaded a larger file on the site, so I added the following line to the httpd.conf file:

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

Therefore, as long as my user is sending data at a rate of at least 500 bytes/second, the request will not time out until the maximum is reached. Reach 600 seconds (better read the documentation, don’t quote me on throughput)
It’s actually a very cool Apache module, but it’s not super well known, because people suggest changing other Apache timeouts in other, similar, “Specified timeout expired:” Settings. The problem is related to PHP-FPM, but any post that costs more than 40 will have this problem in the number of seconds it is committed by default in Apache.

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

Your PHP code seems to have a longer timeout than configured. When Apache USES fCGI to load a PHP page, it sends the request to the PHP-FPM service for processing. If PHP-FPM takes a long time to respond, you will see this type of timeout. The possible reason is that your PHP code may be stuck in a loop or waiting for a response from a database that takes an extremely long time.
To troubleshoot, I’ll use the PHP version of the CLI to see if the script is finished in a reasonable amount of time ($time PHP /path/to/file.php). The PHp-fPM log may contain additional information (default: /var/log/php-fpm.log).
————————————————————————————————————————————————–
I have encountered the same problem, and as far as I am concerned, this solution works:
Add request_terminate_timeout I /etc/php-fpm.d/www.conf file.
Note: This option overrides the PHP max_execution_time INI option and setting a low value for it can cause you a lot of trouble, as it overrides other options and forces the request to terminate when the timeout expires. (If you ask which value to set; It should be based on the maximum script processing time you need, but typically 600s (10 minutes) or 10m (10 minutes) is much more.
—————————————————————————————————————————————————–

-----

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>

Read More: