Solution “111 Connection refused while connecting to upstream”

Once I noticed an error in the /var/log/nginx/error.log:

[error] 29461#29461: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.5.5, server: _, request: "GET /iredadmin/ HTTP/2.0", upstream: "uwsgi://127.0.0.1:7791", host: "192.168.5.1"

The client tried to open iredadmin, which did not open in the browser.

In the config /etc/nginx/templates/iredadmin.tmpl I found:

include uwsgi_params;
    uwsgi_pass 127.0.0.1:7791;
    uwsgi_param UWSGI_CHDIR /opt/www/iredadmin;
    uwsgi_param UWSGI_SCRIPT iredadmin;
    uwsgi_param SCRIPT_NAME /iredadmin;

Check if something works on port 7791 (should be LISTEN):

netstat -na | grep LISTEN | grep 587

It turned out that nothing was running on this port, so I determined that to solve this problem, you just need to start the iredadmin service:

sudo service iredadmin start

After that, the error disappeared and iredadmin opened in the browser.

See also my articles:
Install and configure Nginx
Installing and configuring iRedMail

Leave a comment

Leave a Reply