Solving Apache 503 “Service temporarily unavailable” error

We had a problem with a customer that got a 1 minute timeout when restarting their DJango webapp, claiming that Apache did get stuck. After a test, in the Apache log files we found:

[Thu Oct 11 09:35:18 2012] [error] (111)Connection refused: proxy: HTTP: attempt to connect to ( failed
[Thu Oct 11 09:35:18 2012] [error] ap_proxy_connect_backend disabling worker for (
[Thu Oct 11 09:35:19 2012] [error] proxy: HTTP: disabled connection for (

The problem is that the Apache proxy module, recognising that the service was unavailable, stopped redirecting requests to it for one minute.

The problem was solved adding a retry=0 parameter to the ProxyPass directive:

ProxyPass / retry=0 timeout=5
ProxyPassReverse /

References: Apache mod_proxy documentation, tip.


11 thoughts on “Solving Apache 503 “Service temporarily unavailable” error

  1. Hi Guys,

    This has been a huge help. I’m just curious should we still be seeing the below error in the apache error log after the change?

    [Wed Oct 02 03:33:18 2013] [error] ap_proxy_connect_backend disabling worker for (x.x.x.x)


  2. Hi,
    I had the same problem on a RHEL 6. Even after applying the fix above the problem remained.
    Looking at the Apache log:

    . . .
    [Wed Feb 19 10:58:38 2014] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
    [Wed Feb 19 10:58:38 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
    . . .
    [Wed Feb 19 10:58:59 2014] [error] ap_proxy_connect_backend disabling worker for (localhost)
    [Wed Feb 19 10:59:01 2014] [error] (13)Permission denied: proxy: HTTP: attempt to connect to (localhost) failed
    . . .

    I solved the problem by disabling SELinux
    setenforce permissive


    • you can check with audit2why (yum provides “*/audit2why”, then install that package) the selinux logs and enable booleans or create policies to allow Apache to connect to localhost:3000 :)

  3. Hi,

    I am getting the same issue on Windows 2012 machine. I can’t telnet localhost on port 8080 and there is no antivirus/windows firewall enabled.

    Please advise which conf file I should edit to add the required parameter in Windows 2012.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.