Apache2 Proxy timeoutApache Proxy TimeOut Apache2 PHP5 timeout setting?Apache Request Header Read Timeout (Reverse Proxy)Apache2 virtual host reverse proxy rewrite asset linksapache2 reverse proxy 404 errorApache2 100 seconds timeoutApache keepalive timeoutApache + Event_MPM + FastCgiExternalServer + php5-fpm : php-fpm hangs emergency_restart_threshold does not resetproxy_fcgi:error (70008)Partial results are valid but processing is incomplete. AH01075apache2 reverse proxy configuration

Draw a checker pattern with a black X in the center

How to extract lower and upper bound in numeric format from a confidence interval string?

Future enhancements for the finite element method

Compact Mechanical Energy Source

Leading and Suffering Numbers

Would an object launched by the Catapult spell do full damage against a Scarecrow?

How feasible is the Delta-Glider?

Can a wire having a 610-670 THz (frequency of blue light) AC frequency supply, generate blue light?

What is the 中 in ダウンロード中?

Can't use numexpr in horizontal mode

How do Russian speakers idiomatically express the idea of "Ce n’est pas donné à tout le monde de ..." in French?

Different PCB color ( is it different material? )

Smart people send dumb people to a new planet on a space craft that crashes into a body of water

Is there an explanation for Austria's Freedom Party virtually retaining its vote share despite recent scandal?

Probability of fraction not being able to be simplified

Is it ok to put a subplot to a story that is never meant to contribute to the development of the main plot?

What are these (utility?) boxes at the side of the house?

Split polygon using another polygon in QGIS

Is a post-climate apocolypse city in which many or most insects have disappeared realistic?

Were pen cap holes designed to prevent death by suffocation if swallowed?

Yandex Programming Contest: Alarms

How can I find where certain bash function is defined?

Why did this prime-sequence puzzle not work?

The Passive Wisdom (Perception) score of my character on D&D Beyond seems too high



Apache2 Proxy timeout


Apache Proxy TimeOut Apache2 PHP5 timeout setting?Apache Request Header Read Timeout (Reverse Proxy)Apache2 virtual host reverse proxy rewrite asset linksapache2 reverse proxy 404 errorApache2 100 seconds timeoutApache keepalive timeoutApache + Event_MPM + FastCgiExternalServer + php5-fpm : php-fpm hangs emergency_restart_threshold does not resetproxy_fcgi:error (70008)Partial results are valid but processing is incomplete. AH01075apache2 reverse proxy configuration






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








21















I have Apache2 with PHP + PHP-FPM configured according to:



http://wiki.apache.org/httpd/PHP-FPM



I am writing a script that will take a long time to execute on an internal Vhost, but keep getting timed out, everything runs flawlessly if the script executes in under 30 seconds.



My apache log tells me:



[Wed Apr 17 21:57:23.075175 2013] [proxy_fcgi:error] [pid 9263:tid 140530454267648] (70007)The timeout specified has expired: [client 58.169.202.172:49017] AH01075: Error dispatching request to :, referer:


When trying to run the script I am given a 503 Service Unavailable after exactly 30 seconds of execution time. Logically this would mean I have a timeout directive or setting set to 30 seconds, but I have these in my Vhost's config:



Timeout 600
<IfModule proxy_module>
ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9001/home/pyrokinetiq/scripts/$1 timeout=600
ProxyTimeout 600
</IfModule>


(php-fpm is running on port 9001 for me)



I have also tried placing the Timeout and ProxyTimeout in httpd.conf with no difference.



It seems there's another timeout setting somewhere that's specific to mod_proxy_fcgi, but I can't find it. I installed the Apache2 httpd from the official tarball, none of the mods seem to have come with any configuration files.



If anyone can point me in the right direction it would be much appreciated.










share|improve this question






























    21















    I have Apache2 with PHP + PHP-FPM configured according to:



    http://wiki.apache.org/httpd/PHP-FPM



    I am writing a script that will take a long time to execute on an internal Vhost, but keep getting timed out, everything runs flawlessly if the script executes in under 30 seconds.



    My apache log tells me:



    [Wed Apr 17 21:57:23.075175 2013] [proxy_fcgi:error] [pid 9263:tid 140530454267648] (70007)The timeout specified has expired: [client 58.169.202.172:49017] AH01075: Error dispatching request to :, referer:


    When trying to run the script I am given a 503 Service Unavailable after exactly 30 seconds of execution time. Logically this would mean I have a timeout directive or setting set to 30 seconds, but I have these in my Vhost's config:



    Timeout 600
    <IfModule proxy_module>
    ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9001/home/pyrokinetiq/scripts/$1 timeout=600
    ProxyTimeout 600
    </IfModule>


    (php-fpm is running on port 9001 for me)



    I have also tried placing the Timeout and ProxyTimeout in httpd.conf with no difference.



    It seems there's another timeout setting somewhere that's specific to mod_proxy_fcgi, but I can't find it. I installed the Apache2 httpd from the official tarball, none of the mods seem to have come with any configuration files.



    If anyone can point me in the right direction it would be much appreciated.










    share|improve this question


























      21












      21








      21


      5






      I have Apache2 with PHP + PHP-FPM configured according to:



      http://wiki.apache.org/httpd/PHP-FPM



      I am writing a script that will take a long time to execute on an internal Vhost, but keep getting timed out, everything runs flawlessly if the script executes in under 30 seconds.



      My apache log tells me:



      [Wed Apr 17 21:57:23.075175 2013] [proxy_fcgi:error] [pid 9263:tid 140530454267648] (70007)The timeout specified has expired: [client 58.169.202.172:49017] AH01075: Error dispatching request to :, referer:


      When trying to run the script I am given a 503 Service Unavailable after exactly 30 seconds of execution time. Logically this would mean I have a timeout directive or setting set to 30 seconds, but I have these in my Vhost's config:



      Timeout 600
      <IfModule proxy_module>
      ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9001/home/pyrokinetiq/scripts/$1 timeout=600
      ProxyTimeout 600
      </IfModule>


      (php-fpm is running on port 9001 for me)



      I have also tried placing the Timeout and ProxyTimeout in httpd.conf with no difference.



      It seems there's another timeout setting somewhere that's specific to mod_proxy_fcgi, but I can't find it. I installed the Apache2 httpd from the official tarball, none of the mods seem to have come with any configuration files.



      If anyone can point me in the right direction it would be much appreciated.










      share|improve this question
















      I have Apache2 with PHP + PHP-FPM configured according to:



      http://wiki.apache.org/httpd/PHP-FPM



      I am writing a script that will take a long time to execute on an internal Vhost, but keep getting timed out, everything runs flawlessly if the script executes in under 30 seconds.



      My apache log tells me:



      [Wed Apr 17 21:57:23.075175 2013] [proxy_fcgi:error] [pid 9263:tid 140530454267648] (70007)The timeout specified has expired: [client 58.169.202.172:49017] AH01075: Error dispatching request to :, referer:


      When trying to run the script I am given a 503 Service Unavailable after exactly 30 seconds of execution time. Logically this would mean I have a timeout directive or setting set to 30 seconds, but I have these in my Vhost's config:



      Timeout 600
      <IfModule proxy_module>
      ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9001/home/pyrokinetiq/scripts/$1 timeout=600
      ProxyTimeout 600
      </IfModule>


      (php-fpm is running on port 9001 for me)



      I have also tried placing the Timeout and ProxyTimeout in httpd.conf with no difference.



      It seems there's another timeout setting somewhere that's specific to mod_proxy_fcgi, but I can't find it. I installed the Apache2 httpd from the official tarball, none of the mods seem to have come with any configuration files.



      If anyone can point me in the right direction it would be much appreciated.







      apache-2.2 php php-fpm mod-proxy httpd.conf






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 18 '13 at 5:23







      wyqydsyq

















      asked Apr 18 '13 at 5:11









      wyqydsyqwyqydsyq

      220129




      220129




















          8 Answers
          8






          active

          oldest

          votes


















          30














          I finally fixed this problem after testing several configuration parameters. I tested the solution twice, removing all previous changes. Only one parameter was needed for me to fix it.



          For the latest versions of httpd and mod_proxy_fcgi you can simply add timeout= to the end of the ProxyPassMatch line, e.g.:



          ProxyPassMatch ^/(.+.php.*)$ fcgi://127.0.0.1:9000/<docroot>/$1 timeout=1800


          For older versions it was a little more complicated, e.g.:



          <Proxy fcgi://127.0.0.1:9000>
          ProxySet timeout=1800
          </Proxy>
          ProxyPassMatch ^/(.+.php.*)$ fcgi://127.0.0.1:9000/<docroot>/$1


          I needed to add the Proxy directive to set the timeout to 30 minutes. In some applications, usually when operating database, there are routines that can take more than 10 minutes to execute. I temporary set the timeout to 30 minutes to ensure they finish. Specifically useful when using the installation wizard, which takes too much time (in my humble opinion).



          By the way the intial input that helped me to solve this issue was found in the following URL address.






          share|improve this answer




















          • 1





            It looks like this broke under recent versions of Apache, AH00526: ProxyPass/<Proxy> and ProxyPassMatch/<ProxyMatch> can't be used altogether with the same worker name

            – Stewart Adam
            Jan 24 '15 at 10:15






          • 4





            I have resolved the above by adding a parameter 'timeout=120' at the end of the ProxyPassMatch line.

            – Stewart Adam
            Jan 24 '15 at 10:28











          • @Palantir glad to hear it! Submitted as answer.

            – Stewart Adam
            Jun 11 '15 at 0:54











          • Two more things I needed: First, you -must- set "Timeout" and "ProxyTimeout" in your global apache config file to be longer than the other FPM timeouts. Second, My FPM pool was listening on a unix socket and I use SetHandler like so: [ SetHandler "proxy:unix:/var/run/php/example.com-php7.0-fpm.sock|fcgi://localhost:8000" ] . But <Proxy> matches on the fcgi://localhost part of the SetHandler line (the part AFTER the |... which isn't even actually used !) and NOT the unix:/var/run/ part. so to config timeouts for above use: <Proxy fcgi://localhost:8000> and not <Proxy unix:/var/run/...

            – Professor Falken
            Jun 14 '18 at 17:13



















          8














          I wanted to point out that although this answer works great for older versions, it breaks under recent versions of Apache 2.4 with error code AH00526. ProxyPass and ProxyPassMatch or <Proxy> and <ProxyMatch> cannot be used together within the same worker name. This used to function just fine, so don't know if that was changed by design or if it's a bug.



          Either way, you can fix this by only using a ProxyPassMatch with parameter 'timeout=120' (or whatever your desired value is), e.g.:



          ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9001/path/to/webroot/$1 timeout=120





          share|improve this answer
































            6














            I have Apache 2.4.6, but the patch to fix it is provided in Apache >= 2.4.8.
            The key here is to start your output immediately so that Apache (mod_proxy_fcgi) thinks the connection is active.



            For example, I am using PHP and the DB query for my AJAX call takes > 30 seconds.
            Because I know that the overall response will be "Content-Type: application/json", I send that header immediately.



            #1: Start output immediately
            #Note: Sending the header is innocuous
            # it can be changed later using the $replace parameter
            # (see #3)
            header( 'Content-Type: application/json' );

            #2: Run slow query
            mysql_query( "SELECT * FROM giant_table" );

            #3: Change header as needed
            header( 'Content-Type: application/csv', true );

            #output content





            share|improve this answer






























              2














              Shouldn't that be:



              <IfModule mod_proxy.c>


              Be sure the php.ini setting max_execution_time is set to 600 also.
              (check phpinfo() on the live page to make sure you're seeing the actual value used)



              As Jenny said, set the php-fpm setting



              request_terminate_timeout 610s


              (note the s at the end)



              There's not much to configure with mod_proxy_fcgi itself, as you can see on the apache page.
              http://httpd.apache.org/docs/current/mod/mod_proxy_fcgi.html



              Turn on php-fpm debug logging also so you can see where it times out there.
              http://php-fpm.org/wiki/Configuration_File
              (also turn on catch_workers_output)



              And turn on debug level logging for the mod_proxy and mod_proxy_fcgi modules since you're using apache 2.4. Very nice feature, turn on just for the modules you need:
              http://httpd.apache.org/docs/current/mod/core.html#loglevel



              If those don't help, post your php-fpm config file.



              As a last resort, maybe some daemon is killing long running process?






              share|improve this answer
































                2














                I noted that you are using PHP-FPM. I too use it, but with Apache 2.4.6.



                Assuming that the issue has existed for some time, it seems to be that the timeout value for mod_proxy_fcgi is hard coded. I wrote up what I found here






                share|improve this answer
































                  1














                  Since you've fixed the timout settings in apache, that shouldn't be the issue. The second place to look would be any network equipment, but since you're proxying to your own server, that's also unlikely. So the remaining place to look is at the backend server.



                  Ih the config file for php-pfm, look for



                  ; This is a hard kill switch on php execution. It ignores the
                  ; max_execution_time that can be set/changed with php_ini. Basically
                  ; it avoids timeout issues between apache and php-fpm.
                  request_terminate_timeout=30


                  This should be set to the same as, or slightly below, the timeout setting in apache.






                  share|improve this answer


















                  • 1





                    I've set the request_terminate_timeout to 400, still no change :( I have a feeling that there's something I need to set for mod_proxy_fcgi, but it didn't seem to come with any configuration files.

                    – wyqydsyq
                    Apr 18 '13 at 23:13


















                  0














                  In addition to the timeout, set enablereuse=off. I found when it was on some requests to long running scripts would work correctly and others would be killed early.






                  share|improve this answer






























                    0














                    This post changed the whole deal for me.




                    It looks like the mod_reqtimeout of Apache would not be using the default value.




                    Add the following lines to your httpd.conf file:



                    <IfModule reqtimeout_module>
                    RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500
                    </IfModule>





                    share|improve this answer

























                      Your Answer








                      StackExchange.ready(function()
                      var channelOptions =
                      tags: "".split(" "),
                      id: "2"
                      ;
                      initTagRenderer("".split(" "), "".split(" "), channelOptions);

                      StackExchange.using("externalEditor", function()
                      // Have to fire editor after snippets, if snippets enabled
                      if (StackExchange.settings.snippets.snippetsEnabled)
                      StackExchange.using("snippets", function()
                      createEditor();
                      );

                      else
                      createEditor();

                      );

                      function createEditor()
                      StackExchange.prepareEditor(
                      heartbeatType: 'answer',
                      autoActivateHeartbeat: false,
                      convertImagesToLinks: true,
                      noModals: true,
                      showLowRepImageUploadWarning: true,
                      reputationToPostImages: 10,
                      bindNavPrevention: true,
                      postfix: "",
                      imageUploader:
                      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                      allowUrls: true
                      ,
                      onDemand: true,
                      discardSelector: ".discard-answer"
                      ,immediatelyShowMarkdownHelp:true
                      );



                      );













                      draft saved

                      draft discarded


















                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f500467%2fapache2-proxy-timeout%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown

























                      8 Answers
                      8






                      active

                      oldest

                      votes








                      8 Answers
                      8






                      active

                      oldest

                      votes









                      active

                      oldest

                      votes






                      active

                      oldest

                      votes









                      30














                      I finally fixed this problem after testing several configuration parameters. I tested the solution twice, removing all previous changes. Only one parameter was needed for me to fix it.



                      For the latest versions of httpd and mod_proxy_fcgi you can simply add timeout= to the end of the ProxyPassMatch line, e.g.:



                      ProxyPassMatch ^/(.+.php.*)$ fcgi://127.0.0.1:9000/<docroot>/$1 timeout=1800


                      For older versions it was a little more complicated, e.g.:



                      <Proxy fcgi://127.0.0.1:9000>
                      ProxySet timeout=1800
                      </Proxy>
                      ProxyPassMatch ^/(.+.php.*)$ fcgi://127.0.0.1:9000/<docroot>/$1


                      I needed to add the Proxy directive to set the timeout to 30 minutes. In some applications, usually when operating database, there are routines that can take more than 10 minutes to execute. I temporary set the timeout to 30 minutes to ensure they finish. Specifically useful when using the installation wizard, which takes too much time (in my humble opinion).



                      By the way the intial input that helped me to solve this issue was found in the following URL address.






                      share|improve this answer




















                      • 1





                        It looks like this broke under recent versions of Apache, AH00526: ProxyPass/<Proxy> and ProxyPassMatch/<ProxyMatch> can't be used altogether with the same worker name

                        – Stewart Adam
                        Jan 24 '15 at 10:15






                      • 4





                        I have resolved the above by adding a parameter 'timeout=120' at the end of the ProxyPassMatch line.

                        – Stewart Adam
                        Jan 24 '15 at 10:28











                      • @Palantir glad to hear it! Submitted as answer.

                        – Stewart Adam
                        Jun 11 '15 at 0:54











                      • Two more things I needed: First, you -must- set "Timeout" and "ProxyTimeout" in your global apache config file to be longer than the other FPM timeouts. Second, My FPM pool was listening on a unix socket and I use SetHandler like so: [ SetHandler "proxy:unix:/var/run/php/example.com-php7.0-fpm.sock|fcgi://localhost:8000" ] . But <Proxy> matches on the fcgi://localhost part of the SetHandler line (the part AFTER the |... which isn't even actually used !) and NOT the unix:/var/run/ part. so to config timeouts for above use: <Proxy fcgi://localhost:8000> and not <Proxy unix:/var/run/...

                        – Professor Falken
                        Jun 14 '18 at 17:13
















                      30














                      I finally fixed this problem after testing several configuration parameters. I tested the solution twice, removing all previous changes. Only one parameter was needed for me to fix it.



                      For the latest versions of httpd and mod_proxy_fcgi you can simply add timeout= to the end of the ProxyPassMatch line, e.g.:



                      ProxyPassMatch ^/(.+.php.*)$ fcgi://127.0.0.1:9000/<docroot>/$1 timeout=1800


                      For older versions it was a little more complicated, e.g.:



                      <Proxy fcgi://127.0.0.1:9000>
                      ProxySet timeout=1800
                      </Proxy>
                      ProxyPassMatch ^/(.+.php.*)$ fcgi://127.0.0.1:9000/<docroot>/$1


                      I needed to add the Proxy directive to set the timeout to 30 minutes. In some applications, usually when operating database, there are routines that can take more than 10 minutes to execute. I temporary set the timeout to 30 minutes to ensure they finish. Specifically useful when using the installation wizard, which takes too much time (in my humble opinion).



                      By the way the intial input that helped me to solve this issue was found in the following URL address.






                      share|improve this answer




















                      • 1





                        It looks like this broke under recent versions of Apache, AH00526: ProxyPass/<Proxy> and ProxyPassMatch/<ProxyMatch> can't be used altogether with the same worker name

                        – Stewart Adam
                        Jan 24 '15 at 10:15






                      • 4





                        I have resolved the above by adding a parameter 'timeout=120' at the end of the ProxyPassMatch line.

                        – Stewart Adam
                        Jan 24 '15 at 10:28











                      • @Palantir glad to hear it! Submitted as answer.

                        – Stewart Adam
                        Jun 11 '15 at 0:54











                      • Two more things I needed: First, you -must- set "Timeout" and "ProxyTimeout" in your global apache config file to be longer than the other FPM timeouts. Second, My FPM pool was listening on a unix socket and I use SetHandler like so: [ SetHandler "proxy:unix:/var/run/php/example.com-php7.0-fpm.sock|fcgi://localhost:8000" ] . But <Proxy> matches on the fcgi://localhost part of the SetHandler line (the part AFTER the |... which isn't even actually used !) and NOT the unix:/var/run/ part. so to config timeouts for above use: <Proxy fcgi://localhost:8000> and not <Proxy unix:/var/run/...

                        – Professor Falken
                        Jun 14 '18 at 17:13














                      30












                      30








                      30







                      I finally fixed this problem after testing several configuration parameters. I tested the solution twice, removing all previous changes. Only one parameter was needed for me to fix it.



                      For the latest versions of httpd and mod_proxy_fcgi you can simply add timeout= to the end of the ProxyPassMatch line, e.g.:



                      ProxyPassMatch ^/(.+.php.*)$ fcgi://127.0.0.1:9000/<docroot>/$1 timeout=1800


                      For older versions it was a little more complicated, e.g.:



                      <Proxy fcgi://127.0.0.1:9000>
                      ProxySet timeout=1800
                      </Proxy>
                      ProxyPassMatch ^/(.+.php.*)$ fcgi://127.0.0.1:9000/<docroot>/$1


                      I needed to add the Proxy directive to set the timeout to 30 minutes. In some applications, usually when operating database, there are routines that can take more than 10 minutes to execute. I temporary set the timeout to 30 minutes to ensure they finish. Specifically useful when using the installation wizard, which takes too much time (in my humble opinion).



                      By the way the intial input that helped me to solve this issue was found in the following URL address.






                      share|improve this answer















                      I finally fixed this problem after testing several configuration parameters. I tested the solution twice, removing all previous changes. Only one parameter was needed for me to fix it.



                      For the latest versions of httpd and mod_proxy_fcgi you can simply add timeout= to the end of the ProxyPassMatch line, e.g.:



                      ProxyPassMatch ^/(.+.php.*)$ fcgi://127.0.0.1:9000/<docroot>/$1 timeout=1800


                      For older versions it was a little more complicated, e.g.:



                      <Proxy fcgi://127.0.0.1:9000>
                      ProxySet timeout=1800
                      </Proxy>
                      ProxyPassMatch ^/(.+.php.*)$ fcgi://127.0.0.1:9000/<docroot>/$1


                      I needed to add the Proxy directive to set the timeout to 30 minutes. In some applications, usually when operating database, there are routines that can take more than 10 minutes to execute. I temporary set the timeout to 30 minutes to ensure they finish. Specifically useful when using the installation wizard, which takes too much time (in my humble opinion).



                      By the way the intial input that helped me to solve this issue was found in the following URL address.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jan 7 '16 at 1:59









                      rsaw

                      22315




                      22315










                      answered May 8 '13 at 10:10









                      Jordi FerranJordi Ferran

                      42535




                      42535







                      • 1





                        It looks like this broke under recent versions of Apache, AH00526: ProxyPass/<Proxy> and ProxyPassMatch/<ProxyMatch> can't be used altogether with the same worker name

                        – Stewart Adam
                        Jan 24 '15 at 10:15






                      • 4





                        I have resolved the above by adding a parameter 'timeout=120' at the end of the ProxyPassMatch line.

                        – Stewart Adam
                        Jan 24 '15 at 10:28











                      • @Palantir glad to hear it! Submitted as answer.

                        – Stewart Adam
                        Jun 11 '15 at 0:54











                      • Two more things I needed: First, you -must- set "Timeout" and "ProxyTimeout" in your global apache config file to be longer than the other FPM timeouts. Second, My FPM pool was listening on a unix socket and I use SetHandler like so: [ SetHandler "proxy:unix:/var/run/php/example.com-php7.0-fpm.sock|fcgi://localhost:8000" ] . But <Proxy> matches on the fcgi://localhost part of the SetHandler line (the part AFTER the |... which isn't even actually used !) and NOT the unix:/var/run/ part. so to config timeouts for above use: <Proxy fcgi://localhost:8000> and not <Proxy unix:/var/run/...

                        – Professor Falken
                        Jun 14 '18 at 17:13













                      • 1





                        It looks like this broke under recent versions of Apache, AH00526: ProxyPass/<Proxy> and ProxyPassMatch/<ProxyMatch> can't be used altogether with the same worker name

                        – Stewart Adam
                        Jan 24 '15 at 10:15






                      • 4





                        I have resolved the above by adding a parameter 'timeout=120' at the end of the ProxyPassMatch line.

                        – Stewart Adam
                        Jan 24 '15 at 10:28











                      • @Palantir glad to hear it! Submitted as answer.

                        – Stewart Adam
                        Jun 11 '15 at 0:54











                      • Two more things I needed: First, you -must- set "Timeout" and "ProxyTimeout" in your global apache config file to be longer than the other FPM timeouts. Second, My FPM pool was listening on a unix socket and I use SetHandler like so: [ SetHandler "proxy:unix:/var/run/php/example.com-php7.0-fpm.sock|fcgi://localhost:8000" ] . But <Proxy> matches on the fcgi://localhost part of the SetHandler line (the part AFTER the |... which isn't even actually used !) and NOT the unix:/var/run/ part. so to config timeouts for above use: <Proxy fcgi://localhost:8000> and not <Proxy unix:/var/run/...

                        – Professor Falken
                        Jun 14 '18 at 17:13








                      1




                      1





                      It looks like this broke under recent versions of Apache, AH00526: ProxyPass/<Proxy> and ProxyPassMatch/<ProxyMatch> can't be used altogether with the same worker name

                      – Stewart Adam
                      Jan 24 '15 at 10:15





                      It looks like this broke under recent versions of Apache, AH00526: ProxyPass/<Proxy> and ProxyPassMatch/<ProxyMatch> can't be used altogether with the same worker name

                      – Stewart Adam
                      Jan 24 '15 at 10:15




                      4




                      4





                      I have resolved the above by adding a parameter 'timeout=120' at the end of the ProxyPassMatch line.

                      – Stewart Adam
                      Jan 24 '15 at 10:28





                      I have resolved the above by adding a parameter 'timeout=120' at the end of the ProxyPassMatch line.

                      – Stewart Adam
                      Jan 24 '15 at 10:28













                      @Palantir glad to hear it! Submitted as answer.

                      – Stewart Adam
                      Jun 11 '15 at 0:54





                      @Palantir glad to hear it! Submitted as answer.

                      – Stewart Adam
                      Jun 11 '15 at 0:54













                      Two more things I needed: First, you -must- set "Timeout" and "ProxyTimeout" in your global apache config file to be longer than the other FPM timeouts. Second, My FPM pool was listening on a unix socket and I use SetHandler like so: [ SetHandler "proxy:unix:/var/run/php/example.com-php7.0-fpm.sock|fcgi://localhost:8000" ] . But <Proxy> matches on the fcgi://localhost part of the SetHandler line (the part AFTER the |... which isn't even actually used !) and NOT the unix:/var/run/ part. so to config timeouts for above use: <Proxy fcgi://localhost:8000> and not <Proxy unix:/var/run/...

                      – Professor Falken
                      Jun 14 '18 at 17:13






                      Two more things I needed: First, you -must- set "Timeout" and "ProxyTimeout" in your global apache config file to be longer than the other FPM timeouts. Second, My FPM pool was listening on a unix socket and I use SetHandler like so: [ SetHandler "proxy:unix:/var/run/php/example.com-php7.0-fpm.sock|fcgi://localhost:8000" ] . But <Proxy> matches on the fcgi://localhost part of the SetHandler line (the part AFTER the |... which isn't even actually used !) and NOT the unix:/var/run/ part. so to config timeouts for above use: <Proxy fcgi://localhost:8000> and not <Proxy unix:/var/run/...

                      – Professor Falken
                      Jun 14 '18 at 17:13














                      8














                      I wanted to point out that although this answer works great for older versions, it breaks under recent versions of Apache 2.4 with error code AH00526. ProxyPass and ProxyPassMatch or <Proxy> and <ProxyMatch> cannot be used together within the same worker name. This used to function just fine, so don't know if that was changed by design or if it's a bug.



                      Either way, you can fix this by only using a ProxyPassMatch with parameter 'timeout=120' (or whatever your desired value is), e.g.:



                      ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9001/path/to/webroot/$1 timeout=120





                      share|improve this answer





























                        8














                        I wanted to point out that although this answer works great for older versions, it breaks under recent versions of Apache 2.4 with error code AH00526. ProxyPass and ProxyPassMatch or <Proxy> and <ProxyMatch> cannot be used together within the same worker name. This used to function just fine, so don't know if that was changed by design or if it's a bug.



                        Either way, you can fix this by only using a ProxyPassMatch with parameter 'timeout=120' (or whatever your desired value is), e.g.:



                        ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9001/path/to/webroot/$1 timeout=120





                        share|improve this answer



























                          8












                          8








                          8







                          I wanted to point out that although this answer works great for older versions, it breaks under recent versions of Apache 2.4 with error code AH00526. ProxyPass and ProxyPassMatch or <Proxy> and <ProxyMatch> cannot be used together within the same worker name. This used to function just fine, so don't know if that was changed by design or if it's a bug.



                          Either way, you can fix this by only using a ProxyPassMatch with parameter 'timeout=120' (or whatever your desired value is), e.g.:



                          ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9001/path/to/webroot/$1 timeout=120





                          share|improve this answer















                          I wanted to point out that although this answer works great for older versions, it breaks under recent versions of Apache 2.4 with error code AH00526. ProxyPass and ProxyPassMatch or <Proxy> and <ProxyMatch> cannot be used together within the same worker name. This used to function just fine, so don't know if that was changed by design or if it's a bug.



                          Either way, you can fix this by only using a ProxyPassMatch with parameter 'timeout=120' (or whatever your desired value is), e.g.:



                          ProxyPassMatch ^/(.*.php)$ fcgi://127.0.0.1:9001/path/to/webroot/$1 timeout=120






                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Apr 13 '17 at 12:14









                          Community

                          1




                          1










                          answered Jun 11 '15 at 0:53









                          Stewart AdamStewart Adam

                          34934




                          34934





















                              6














                              I have Apache 2.4.6, but the patch to fix it is provided in Apache >= 2.4.8.
                              The key here is to start your output immediately so that Apache (mod_proxy_fcgi) thinks the connection is active.



                              For example, I am using PHP and the DB query for my AJAX call takes > 30 seconds.
                              Because I know that the overall response will be "Content-Type: application/json", I send that header immediately.



                              #1: Start output immediately
                              #Note: Sending the header is innocuous
                              # it can be changed later using the $replace parameter
                              # (see #3)
                              header( 'Content-Type: application/json' );

                              #2: Run slow query
                              mysql_query( "SELECT * FROM giant_table" );

                              #3: Change header as needed
                              header( 'Content-Type: application/csv', true );

                              #output content





                              share|improve this answer



























                                6














                                I have Apache 2.4.6, but the patch to fix it is provided in Apache >= 2.4.8.
                                The key here is to start your output immediately so that Apache (mod_proxy_fcgi) thinks the connection is active.



                                For example, I am using PHP and the DB query for my AJAX call takes > 30 seconds.
                                Because I know that the overall response will be "Content-Type: application/json", I send that header immediately.



                                #1: Start output immediately
                                #Note: Sending the header is innocuous
                                # it can be changed later using the $replace parameter
                                # (see #3)
                                header( 'Content-Type: application/json' );

                                #2: Run slow query
                                mysql_query( "SELECT * FROM giant_table" );

                                #3: Change header as needed
                                header( 'Content-Type: application/csv', true );

                                #output content





                                share|improve this answer

























                                  6












                                  6








                                  6







                                  I have Apache 2.4.6, but the patch to fix it is provided in Apache >= 2.4.8.
                                  The key here is to start your output immediately so that Apache (mod_proxy_fcgi) thinks the connection is active.



                                  For example, I am using PHP and the DB query for my AJAX call takes > 30 seconds.
                                  Because I know that the overall response will be "Content-Type: application/json", I send that header immediately.



                                  #1: Start output immediately
                                  #Note: Sending the header is innocuous
                                  # it can be changed later using the $replace parameter
                                  # (see #3)
                                  header( 'Content-Type: application/json' );

                                  #2: Run slow query
                                  mysql_query( "SELECT * FROM giant_table" );

                                  #3: Change header as needed
                                  header( 'Content-Type: application/csv', true );

                                  #output content





                                  share|improve this answer













                                  I have Apache 2.4.6, but the patch to fix it is provided in Apache >= 2.4.8.
                                  The key here is to start your output immediately so that Apache (mod_proxy_fcgi) thinks the connection is active.



                                  For example, I am using PHP and the DB query for my AJAX call takes > 30 seconds.
                                  Because I know that the overall response will be "Content-Type: application/json", I send that header immediately.



                                  #1: Start output immediately
                                  #Note: Sending the header is innocuous
                                  # it can be changed later using the $replace parameter
                                  # (see #3)
                                  header( 'Content-Type: application/json' );

                                  #2: Run slow query
                                  mysql_query( "SELECT * FROM giant_table" );

                                  #3: Change header as needed
                                  header( 'Content-Type: application/csv', true );

                                  #output content






                                  share|improve this answer












                                  share|improve this answer



                                  share|improve this answer










                                  answered Jan 5 '16 at 4:53









                                  ChrisChris

                                  6112




                                  6112





















                                      2














                                      Shouldn't that be:



                                      <IfModule mod_proxy.c>


                                      Be sure the php.ini setting max_execution_time is set to 600 also.
                                      (check phpinfo() on the live page to make sure you're seeing the actual value used)



                                      As Jenny said, set the php-fpm setting



                                      request_terminate_timeout 610s


                                      (note the s at the end)



                                      There's not much to configure with mod_proxy_fcgi itself, as you can see on the apache page.
                                      http://httpd.apache.org/docs/current/mod/mod_proxy_fcgi.html



                                      Turn on php-fpm debug logging also so you can see where it times out there.
                                      http://php-fpm.org/wiki/Configuration_File
                                      (also turn on catch_workers_output)



                                      And turn on debug level logging for the mod_proxy and mod_proxy_fcgi modules since you're using apache 2.4. Very nice feature, turn on just for the modules you need:
                                      http://httpd.apache.org/docs/current/mod/core.html#loglevel



                                      If those don't help, post your php-fpm config file.



                                      As a last resort, maybe some daemon is killing long running process?






                                      share|improve this answer





























                                        2














                                        Shouldn't that be:



                                        <IfModule mod_proxy.c>


                                        Be sure the php.ini setting max_execution_time is set to 600 also.
                                        (check phpinfo() on the live page to make sure you're seeing the actual value used)



                                        As Jenny said, set the php-fpm setting



                                        request_terminate_timeout 610s


                                        (note the s at the end)



                                        There's not much to configure with mod_proxy_fcgi itself, as you can see on the apache page.
                                        http://httpd.apache.org/docs/current/mod/mod_proxy_fcgi.html



                                        Turn on php-fpm debug logging also so you can see where it times out there.
                                        http://php-fpm.org/wiki/Configuration_File
                                        (also turn on catch_workers_output)



                                        And turn on debug level logging for the mod_proxy and mod_proxy_fcgi modules since you're using apache 2.4. Very nice feature, turn on just for the modules you need:
                                        http://httpd.apache.org/docs/current/mod/core.html#loglevel



                                        If those don't help, post your php-fpm config file.



                                        As a last resort, maybe some daemon is killing long running process?






                                        share|improve this answer



























                                          2












                                          2








                                          2







                                          Shouldn't that be:



                                          <IfModule mod_proxy.c>


                                          Be sure the php.ini setting max_execution_time is set to 600 also.
                                          (check phpinfo() on the live page to make sure you're seeing the actual value used)



                                          As Jenny said, set the php-fpm setting



                                          request_terminate_timeout 610s


                                          (note the s at the end)



                                          There's not much to configure with mod_proxy_fcgi itself, as you can see on the apache page.
                                          http://httpd.apache.org/docs/current/mod/mod_proxy_fcgi.html



                                          Turn on php-fpm debug logging also so you can see where it times out there.
                                          http://php-fpm.org/wiki/Configuration_File
                                          (also turn on catch_workers_output)



                                          And turn on debug level logging for the mod_proxy and mod_proxy_fcgi modules since you're using apache 2.4. Very nice feature, turn on just for the modules you need:
                                          http://httpd.apache.org/docs/current/mod/core.html#loglevel



                                          If those don't help, post your php-fpm config file.



                                          As a last resort, maybe some daemon is killing long running process?






                                          share|improve this answer















                                          Shouldn't that be:



                                          <IfModule mod_proxy.c>


                                          Be sure the php.ini setting max_execution_time is set to 600 also.
                                          (check phpinfo() on the live page to make sure you're seeing the actual value used)



                                          As Jenny said, set the php-fpm setting



                                          request_terminate_timeout 610s


                                          (note the s at the end)



                                          There's not much to configure with mod_proxy_fcgi itself, as you can see on the apache page.
                                          http://httpd.apache.org/docs/current/mod/mod_proxy_fcgi.html



                                          Turn on php-fpm debug logging also so you can see where it times out there.
                                          http://php-fpm.org/wiki/Configuration_File
                                          (also turn on catch_workers_output)



                                          And turn on debug level logging for the mod_proxy and mod_proxy_fcgi modules since you're using apache 2.4. Very nice feature, turn on just for the modules you need:
                                          http://httpd.apache.org/docs/current/mod/core.html#loglevel



                                          If those don't help, post your php-fpm config file.



                                          As a last resort, maybe some daemon is killing long running process?







                                          share|improve this answer














                                          share|improve this answer



                                          share|improve this answer








                                          edited Apr 19 '13 at 3:39

























                                          answered Apr 19 '13 at 3:08









                                          trosemantroseman

                                          30117




                                          30117





















                                              2














                                              I noted that you are using PHP-FPM. I too use it, but with Apache 2.4.6.



                                              Assuming that the issue has existed for some time, it seems to be that the timeout value for mod_proxy_fcgi is hard coded. I wrote up what I found here






                                              share|improve this answer





























                                                2














                                                I noted that you are using PHP-FPM. I too use it, but with Apache 2.4.6.



                                                Assuming that the issue has existed for some time, it seems to be that the timeout value for mod_proxy_fcgi is hard coded. I wrote up what I found here






                                                share|improve this answer



























                                                  2












                                                  2








                                                  2







                                                  I noted that you are using PHP-FPM. I too use it, but with Apache 2.4.6.



                                                  Assuming that the issue has existed for some time, it seems to be that the timeout value for mod_proxy_fcgi is hard coded. I wrote up what I found here






                                                  share|improve this answer















                                                  I noted that you are using PHP-FPM. I too use it, but with Apache 2.4.6.



                                                  Assuming that the issue has existed for some time, it seems to be that the timeout value for mod_proxy_fcgi is hard coded. I wrote up what I found here







                                                  share|improve this answer














                                                  share|improve this answer



                                                  share|improve this answer








                                                  edited May 23 '17 at 12:41









                                                  Community

                                                  1




                                                  1










                                                  answered Mar 19 '14 at 21:51









                                                  misterichmisterich

                                                  415




                                                  415





















                                                      1














                                                      Since you've fixed the timout settings in apache, that shouldn't be the issue. The second place to look would be any network equipment, but since you're proxying to your own server, that's also unlikely. So the remaining place to look is at the backend server.



                                                      Ih the config file for php-pfm, look for



                                                      ; This is a hard kill switch on php execution. It ignores the
                                                      ; max_execution_time that can be set/changed with php_ini. Basically
                                                      ; it avoids timeout issues between apache and php-fpm.
                                                      request_terminate_timeout=30


                                                      This should be set to the same as, or slightly below, the timeout setting in apache.






                                                      share|improve this answer


















                                                      • 1





                                                        I've set the request_terminate_timeout to 400, still no change :( I have a feeling that there's something I need to set for mod_proxy_fcgi, but it didn't seem to come with any configuration files.

                                                        – wyqydsyq
                                                        Apr 18 '13 at 23:13















                                                      1














                                                      Since you've fixed the timout settings in apache, that shouldn't be the issue. The second place to look would be any network equipment, but since you're proxying to your own server, that's also unlikely. So the remaining place to look is at the backend server.



                                                      Ih the config file for php-pfm, look for



                                                      ; This is a hard kill switch on php execution. It ignores the
                                                      ; max_execution_time that can be set/changed with php_ini. Basically
                                                      ; it avoids timeout issues between apache and php-fpm.
                                                      request_terminate_timeout=30


                                                      This should be set to the same as, or slightly below, the timeout setting in apache.






                                                      share|improve this answer


















                                                      • 1





                                                        I've set the request_terminate_timeout to 400, still no change :( I have a feeling that there's something I need to set for mod_proxy_fcgi, but it didn't seem to come with any configuration files.

                                                        – wyqydsyq
                                                        Apr 18 '13 at 23:13













                                                      1












                                                      1








                                                      1







                                                      Since you've fixed the timout settings in apache, that shouldn't be the issue. The second place to look would be any network equipment, but since you're proxying to your own server, that's also unlikely. So the remaining place to look is at the backend server.



                                                      Ih the config file for php-pfm, look for



                                                      ; This is a hard kill switch on php execution. It ignores the
                                                      ; max_execution_time that can be set/changed with php_ini. Basically
                                                      ; it avoids timeout issues between apache and php-fpm.
                                                      request_terminate_timeout=30


                                                      This should be set to the same as, or slightly below, the timeout setting in apache.






                                                      share|improve this answer













                                                      Since you've fixed the timout settings in apache, that shouldn't be the issue. The second place to look would be any network equipment, but since you're proxying to your own server, that's also unlikely. So the remaining place to look is at the backend server.



                                                      Ih the config file for php-pfm, look for



                                                      ; This is a hard kill switch on php execution. It ignores the
                                                      ; max_execution_time that can be set/changed with php_ini. Basically
                                                      ; it avoids timeout issues between apache and php-fpm.
                                                      request_terminate_timeout=30


                                                      This should be set to the same as, or slightly below, the timeout setting in apache.







                                                      share|improve this answer












                                                      share|improve this answer



                                                      share|improve this answer










                                                      answered Apr 18 '13 at 9:23









                                                      Jenny DJenny D

                                                      24.5k116296




                                                      24.5k116296







                                                      • 1





                                                        I've set the request_terminate_timeout to 400, still no change :( I have a feeling that there's something I need to set for mod_proxy_fcgi, but it didn't seem to come with any configuration files.

                                                        – wyqydsyq
                                                        Apr 18 '13 at 23:13












                                                      • 1





                                                        I've set the request_terminate_timeout to 400, still no change :( I have a feeling that there's something I need to set for mod_proxy_fcgi, but it didn't seem to come with any configuration files.

                                                        – wyqydsyq
                                                        Apr 18 '13 at 23:13







                                                      1




                                                      1





                                                      I've set the request_terminate_timeout to 400, still no change :( I have a feeling that there's something I need to set for mod_proxy_fcgi, but it didn't seem to come with any configuration files.

                                                      – wyqydsyq
                                                      Apr 18 '13 at 23:13





                                                      I've set the request_terminate_timeout to 400, still no change :( I have a feeling that there's something I need to set for mod_proxy_fcgi, but it didn't seem to come with any configuration files.

                                                      – wyqydsyq
                                                      Apr 18 '13 at 23:13











                                                      0














                                                      In addition to the timeout, set enablereuse=off. I found when it was on some requests to long running scripts would work correctly and others would be killed early.






                                                      share|improve this answer



























                                                        0














                                                        In addition to the timeout, set enablereuse=off. I found when it was on some requests to long running scripts would work correctly and others would be killed early.






                                                        share|improve this answer

























                                                          0












                                                          0








                                                          0







                                                          In addition to the timeout, set enablereuse=off. I found when it was on some requests to long running scripts would work correctly and others would be killed early.






                                                          share|improve this answer













                                                          In addition to the timeout, set enablereuse=off. I found when it was on some requests to long running scripts would work correctly and others would be killed early.







                                                          share|improve this answer












                                                          share|improve this answer



                                                          share|improve this answer










                                                          answered May 12 '16 at 14:10









                                                          ctlqctlq

                                                          4114




                                                          4114





















                                                              0














                                                              This post changed the whole deal for me.




                                                              It looks like the mod_reqtimeout of Apache would not be using the default value.




                                                              Add the following lines to your httpd.conf file:



                                                              <IfModule reqtimeout_module>
                                                              RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500
                                                              </IfModule>





                                                              share|improve this answer





























                                                                0














                                                                This post changed the whole deal for me.




                                                                It looks like the mod_reqtimeout of Apache would not be using the default value.




                                                                Add the following lines to your httpd.conf file:



                                                                <IfModule reqtimeout_module>
                                                                RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500
                                                                </IfModule>





                                                                share|improve this answer



























                                                                  0












                                                                  0








                                                                  0







                                                                  This post changed the whole deal for me.




                                                                  It looks like the mod_reqtimeout of Apache would not be using the default value.




                                                                  Add the following lines to your httpd.conf file:



                                                                  <IfModule reqtimeout_module>
                                                                  RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500
                                                                  </IfModule>





                                                                  share|improve this answer















                                                                  This post changed the whole deal for me.




                                                                  It looks like the mod_reqtimeout of Apache would not be using the default value.




                                                                  Add the following lines to your httpd.conf file:



                                                                  <IfModule reqtimeout_module>
                                                                  RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500
                                                                  </IfModule>






                                                                  share|improve this answer














                                                                  share|improve this answer



                                                                  share|improve this answer








                                                                  edited May 15 at 11:30

























                                                                  answered May 15 at 11:24









                                                                  Frosty ZFrosty Z

                                                                  18818




                                                                  18818



























                                                                      draft saved

                                                                      draft discarded
















































                                                                      Thanks for contributing an answer to Server Fault!


                                                                      • Please be sure to answer the question. Provide details and share your research!

                                                                      But avoid


                                                                      • Asking for help, clarification, or responding to other answers.

                                                                      • Making statements based on opinion; back them up with references or personal experience.

                                                                      To learn more, see our tips on writing great answers.




                                                                      draft saved


                                                                      draft discarded














                                                                      StackExchange.ready(
                                                                      function ()
                                                                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f500467%2fapache2-proxy-timeout%23new-answer', 'question_page');

                                                                      );

                                                                      Post as a guest















                                                                      Required, but never shown





















































                                                                      Required, but never shown














                                                                      Required, but never shown












                                                                      Required, but never shown







                                                                      Required, but never shown

































                                                                      Required, but never shown














                                                                      Required, but never shown












                                                                      Required, but never shown







                                                                      Required, but never shown







                                                                      Popular posts from this blog

                                                                      Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

                                                                      Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

                                                                      What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company