Question

Nginx odoo 16 proxy and connect() failed (111: Connection refused)

I’ve got these in the log file on odoo nginx proxy:

connect() failed (111: Connection refused) while connecting to upstream, client: 8**.**.**.***, server: bit ****.dns.org, request: "GET /websocket HTTP/1.1", upstream: "http://127.0.0.1:8072/websocket", host: "www.bit***.dns.org"

root@bi:/var/log/nginx#

Another error when I tried to access

"GET /websocket HTTP/1.1" 502 575

I needed to change /etc/hosts form : #127.0.0.1 localhost to 127.0.0.1 bit****.dns.org

Becouse i need to get a certificate with certbot.

My configuration on nginx is

# Odoo Upstreams

upstream odooserver {

    server 127.0.0.1:8069;

}

upstream odoochat {

server  127.0.0.1:8072;

}

map $http_upgrade $connection_upgrade {

default upgrade;

'' close;

}

location /websocket {

proxy_redirect off;

proxy_read_timeout 720s;

proxy_connect_timeout 720s;

proxy_send_timeout 720s;

# Add Headers for odoo proxy mode

proxy_set_header X-Forwarded-Host $host;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Proto $scheme;

proxy_set_header X-Real-IP $remote_addr;

#added 95-a 98

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection "Upgrade";

proxy_pass http://odoochat;

  }

Why connect() failed (111: Connection refused) ?

Thanks

Show comments

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.

KFSys
Site Moderator
Site Moderator badge
September 12, 2024

Heya,

The error connect() failed (111: Connection refused) while connecting to upstream is not connected to Nginx.

The error suggest an issue with the application rather than your WebService. What I’ll recommend is to check your application’s error log. You’ll see the exact error there, it will for sure be connected to your App in someway.

Hi there,

The 502 is a generic error that just informs you that the proxy serivce is unable to connect to your backend service.

The first thing to check is whether the Odoo service, specifically the WebSocket service, is running on port 8072. You can verify this by using the following command:

sudo netstat -tuln | grep 8072

If the service is not running, you may need to start or restart the Odoo service:

sudo systemctl restart odoo

Ensure that the configuration file for Odoo (odoo.conf) has the correct port settings and that the WebSocket service is enabled.

Let me know how it goes!

- Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more