Question

connect() failed (111: Connection refused) while connecting to upstream

Hi,

I have update my website build on flask by pulling updates from git and I got this:

2020/01/10 20:42:02 [error] 2906#2906: *1 connect() to unix:/home/bartek/config/website.sock failed (111: Connection refused) while connecting to upstream, client: 84.213.215.255, server: bartoszkobylinski.com, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:/home/bartek/config/website.sock:", host: "bartoszkobylinski.com", referrer: "http://bartoszkobylinski.com/"

I haven’t done anything else just pulling repo. I reboot server. I have checked uwsgi settings and nginx but nothing has changed. I have seen many same issue with it where it was to many services going but I have checked with command netstat -plant and I got this:

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      2902/nginx: master  
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      714/systemd-resolve 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      918/sshd            
tcp        0      0 142.93.100.171:22       106.52.102.190:50886    ESTABLISHED 3001/sshd: [accepte 
tcp        0      0 142.93.100.171:22       84.213.215.255:46096    ESTABLISHED 1756/sshd: bartek [ 
tcp        0      0 142.93.100.171:22       203.220.101.126:25270   ESTABLISHED 3031/sshd: unknown  
tcp        0      0 142.93.100.171:22       218.92.0.202:52288      SYN_RECV    -                   
tcp        0      0 142.93.100.171:22       218.92.0.202:36789      SYN_RECV    -                   
tcp        0      0 142.93.100.171:22       84.213.215.255:46010    ESTABLISHED 1477/sshd: bartek [ 
tcp        0      0 142.93.100.171:22       218.92.0.202:13016      SYN_RECV    -                   
tcp        0      0 142.93.100.171:22       84.213.215.255:45918    ESTABLISHED 1126/sshd: bartek [ 
tcp        0    340 142.93.100.171:22       84.213.215.255:47410    ESTABLISHED 2599/sshd: bartek [ 
tcp6       0      0 :::80                   :::*                    LISTEN      2902/nginx: master  
tcp6       0      0 :::22                   :::*                    LISTEN      918/sshd  

Actually I have no clue where to start now or how to solve it. Could anyone provide some solutions

Thanks in advance! Bart


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello,

It sounds like that your Flesk application is not running. Make sure that you start your application and then it should work as expected.

Besides that what I could suggest is creating a systemd unit file. Creating a systemd unit file will allow Ubuntu’s init system to automatically start uWSGI and serve the Flask application whenever the server boots.

You can take a look at this article her eon how to set that up:

https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uswgi-and-nginx-on-ubuntu-18-04#step-4-—-configuring-uwsgi

On another note, here is a link to an answer on how to troubleshoot common Nginx problems:

https://www.digitalocean.com/community/questions/how-to-troubleshoot-common-nginx-issues-on-linux-server

And here is also a quick video demo on how to do that as well:

Hope that this helps! Regards, Bobby