connect() failed (111: Connection refused) while connecting to upstream, client ….

If you are getting this error suddenly and intermittently, this may be due to issues resolving localhost intermittently, perhaps intermittently when attempting IPv6 vs IPv4.

I was able to solve the problem by changing my references to localhost to 127.0.0.1 in my nginx configs.

4 Comments

  1. John Sherwood says:

    We just moved to a cluster and got pages of these errors. This fixed it in a flash. Thank you so much.

    1. Yuji says:

      I just had this issue less than a week ago, glad you were able to fix it!

  2. Kingsley says:

    I am using plesk and this has been a regular thing

  3. Petere says:

    What did you change to what?
    localhost to 127….
    or
    127 to localhost?

Leave a reply to Petere Cancel reply