Tons of `connect() failed (111: Connection refused) while connecting to upstream` in nginx log

See original GitHub issue

I have Synapse set up with a nginx as a reverse proxy on the client port. I was looking at my nginx logs for other reasons, but realized they are filled with errors line like this:

connect() failed (111: Connection refused) while connecting to upstream, client: <myclientip>, server: <mymatrixHShostname>, request: "GET /_matrix/client/…"

This is quite annoying by itself, but might even be a symptom for an actual issue.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:12
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
cjdelislecommented, Sep 7, 2017

My issue seems to be that localhost is sometimes resolved as IPv4 and sometimes as IPv6, when it’s resolved as IPv6 there is nobody home to handle the request and it fails. I just changed localhost to 127.0.0.1 in the conf and it has stopped for a while…

3reactions
alasdairdccommented, Sep 26, 2018

@Qwertie- have you redacted your internal ip address to http://0.0.0.0:8008;? The IP 0.0.0.0 is a null route and wont go anywhere. If it is indeed specified as such in config and it’s running on the same machine change it to the loopback IP of 127.0.0.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connection refused) while connecting to upstream - Server Fault
'Connection refused' means that backend does not listen to the port 9000 or its queue is filled up. This problem is related to...
Read more >
connect() failed (111: Connection refused) while connecting to ...
Hi all,. Followed this tutorial to get Let's Encrypt working on my Nest.js/Node server. Everything works - running sudo nginx -t returns:.
Read more >
php - nginx: connect() failed (111: Connection refused) while ...
The solution was a lot easier than what I thought. simply, open the following path to your php5-fpm sudo nano /etc/php5/fpm/pool.d/www.conf.
Read more >
failed (111: Connection refused) while connecting to upstream ...
502 usually means that nginx is failing to connect to Mastodon. It's a good idea in this case to check the Mastodon logs....
Read more >
nginx erratic error "111: Connection refused while serving ...
I get this error logged despite the video being loaded and played successfully; From time to time, my system seem to crash -...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found