Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Odoo 16 websocket problem with Nginx

Subscribe

Get notified when there's activity on this post

This question has been flagged
nginxodoo16features
9 Replies
31066 Views
Avatar
GT Apps

Hello everyone,

I'm trying to deploy Odoo 16 on my server but I cannot make the chat works, the new messages are not displayed until I restart the web page.

I enabled multi workers mode and proxy_mode in my odoo.conf, and here is my nginx.conf (the same as Odoo documentation):

#odoo server
upstream odoo {
server 127.0.0.1:8069;
}
upstream odoochat {
server 127.0.0.1:8072;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

# http -> https
server {
listen 80;
server_name odoo.gp;
rewrite ^(.*) https://$host$1 permanent;
}

server {
listen 443 ssl;
server_name odoo.gp;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;

# SSL parameters
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/key.pem;
ssl_session_timeout 30m;
ssl_protocols TLSv1.2;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;

# log
access_log /var/log/nginx/access_odoo.gp.log;
error_log /var/log/nginx/error_odoo.gp.log;

# Redirect websocket requests to odoo gevent port
location /websocket {
proxy_pass http://odoochat;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
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;
}

# Redirect requests to odoo backend server
location / {
# 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;
proxy_redirect off;
proxy_pass http://odoo;
}

# common gzip
gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
gzip on;
}

Please help! Thanks!

0
Avatar
Discard
GT Apps
Author

Is there anyone? :(

Avatar
GT Apps
Author Best Answer

After many times digging, I found out where my problem is and fixed it. The problem is Google Chrome (and other chromium-based browsers) rejects the websocket connection due to my self-signed SSL certificate. On Firefox, it works fine. So I have to create my own CA certificate and add it to the trusted list of Google Chrome (as the instruction here https://dgu2000.medium.com/working-with-self-signed-certificates-in-chrome-walkthrough-edition-a238486e6858).

Hope it helps someone who facing the same problem when trying to deploy on local machine.

0
Avatar
Discard
Avatar
Abdul Halim
Best Answer

@Bojan Nišević adding in odoo-server.conf file.

xmlrpc_interface = 127.0.0.1

 solved my issue!

1
Avatar
Discard
Avatar
Abdul Kadhar
Best Answer

In Odoo18, I Got The Below Error From Terminal while Refreshing The Page. Also I Cant See Any Error From UI. (Like PopUp.)

RuntimeError: Couldn't bind the websocket. Is the connection opened on the evented port (8072)?




After Commanded Some Line Conf, It Working Correctly.

#workers = 4

#limit_memory_soft = 471974428

#limit_memory_hard = 3299788800

#limit_request = 1200

#limit_time_cpu = 1200

#limit_time_real = 2400

#max_cron_threads = 1


Thanks,
Abdul Kather S

0
Avatar
Discard
Avatar
deva
Best Answer

Here the error was also occurring because of the settings:


limit_memory_hard = 20132659200

limit_memory_soft = 1677721600

limit_request = 8192

limit_time_cpu = 3600

limt_time_real = 7200

limit_time_real_cron = -1

max_cron_threads = 1

workers = 25


Remove all of these settings from your conf file. 
It will work !

0
Avatar
Discard
Avatar
Byron Guerrero
Best Answer

I am also having the same issue I am on odoo17 and cant get it to work please help!

0
Avatar
Discard
Avatar
Nomazy
Best Answer

Same issue in Discuss, Inbound

With nginx no answer, even with refresh the browser (firefox or chrome) and in odoo log : POST /longpolling/poll HTTP/1.1" 404.

Without nginx, direct with http://localhost:8069, no answer and in odoo log : RuntimeError: Couldn't bind the websocket. Is the connection opened on the evented port (8072)?

nginx conf :

    server 127.0.0.1:8069;
}

upstream odoochat {
    server 127.0.0.1:8072 weight=1 fail_timeout=0;
}

server {
listen 80;
listen [::]:80;
        server_name localodoo.erp;
       
        # log
access_log /var/log/nginx16/accesslocalodoo.log;
error_log /var/log/nginx16/errorlocalodoo.log;

# Set headers for 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;

        # Set timeouts
        proxy_connect_timeout   3600;
        proxy_send_timeout      3600;
        proxy_read_timeout      3600;
       
        # Gzip
        send_timeout            3600;
        client_body_in_file_only clean;
client_body_buffer_size 32K;
client_max_body_size 500M;
sendfile on;

    location /websocket {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://odoochat;
proxy_redirect off;
}

           
    location / {
proxy_redirect off;
proxy_pass http://odoo;
add_header Access-Control-Allow-Origin *;
}

    # common gzip
    gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
    gzip on;
       
}>
In odoo conf :
xmlrpc_port = 8069
#xmlrpc_interface = 127.0.0.1
gevent_port = 8072
limit_memory_hard = 1677721600
limit_memory_soft = 629145600
limit_request = 8192
limit_time_cpu = 600
limit_time_real = 1200
max_cron_threads = 1
workers = 4>

Please help
0
Avatar
Discard
Avatar
Mimacro
Best Answer

Greetings, 


I have this same error only with odoo version 16, I would like to know some solution if someone could solve it.


Thank you.

0
Avatar
Discard
Avatar
Bojan Nišević
Best Answer

I have the same issue, tried everything, /websocket configuration in nginx, proxy mode is True. Nothing helps. I am getting 

Websocket(request.httprequest.environ['socket'], request.session),

KeyError: 'socket'

0
Avatar
Discard
Avatar
CandidRoot Solutions Private Limited
Best Answer

Hello

Need to change in nginx.conf and odoo.conf as follow

map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

# Redirect websocket requests to odoo gevent port
location /websocket {
proxy_pass http://odoochat;
proxy_set_header X-Real-IP $remote_addr;

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
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;
}

Also add worker and max_cron_threads as per server configuration in /etc/odoo-server.conf

max_cron_threads = 1
workers = 4
db_name=DatabaseName
dbfilter=
proxy_mode=True

Thanks & Regards,

​

CandidRoot Solutions Pvt. Ltd.

Mobile: (+91) 8849036209
Email: info@candidroot.com
Skype: live:candidroot
Web: https://www.candidroot.com
Address: 1229-1230, Iconic Shyamal, Near Shyamal Cross Road, Ahmedabad, Gujarat

0
Avatar
Discard
GT Apps
Author

I don't see any difference in your suggestion. Anyway, I copied your config and still no luck :(

CandidRoot Solutions Private Limited

Hello Giang Pham,

Thank you for your feedback.

have you updated odoo.conf file as per my answer?

if you have still issue then i want to check your odoo log file and other configuration.

feel free to connect with me

CandidRoot Solutions Pvt. Ltd.
Mobile: (+91) 8849036209
Email: info@candidroot.com
Skype: live:candidroot
Web: https://www.candidroot.com
Address: 1229-1230, Iconic Shyamal, Near Shyamal Cross Road, Ahmedabad, Gujarat

GT Apps
Author

Yes, here is my odoo.conf:

[options]
addons_path = /opt/odoo/16.0/addons
admin_passwd = xxx
csv_internal_sep = ,
data_dir = /home/admin/.local/share/OpenERP
dbfilter =
db_host = 127.0.0.1
db_maxconn = 64
db_name = odoo16-demo
db_password = odoo
db_port = 5433
db_sslmode = prefer
db_template = template0
db_user = odoo
demo = {}
email_from = False
geoip_database = /usr/share/GeoIP/GeoLite2-City.mmdb
gevent_port = 8072
http_enable = True
http_interface =
http_port = 8069
import_partial =
limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 60
limit_time_real = 120
limit_time_real_cron = -1
list_db = False
log_db = False
log_db_level = warning
logfile = /home/admin/odoolog/odoo.log
log_handler = :INFO
log_level = info
max_cron_threads = 2
osv_memory_count_limit = False
pg_path =
pidfile =
proxy_mode = True
reportgz = False
screencasts =
screenshots = /tmp/odoo_tests
server_wide_modules = base,web
smtp_password = False
smtp_port = 25
smtp_server = localhost
smtp_ssl = False
smtp_user = False
syslog = False
test_enable = False
test_file =
test_tags = None
transient_age_limit = 1.0
translate_modules = ['all']
unaccent = True
upgrade_path =
without_demo = False
workers = 3

I don't know if this is a problem or not, but my nginx hosts multiple config files for multiple odoo instances, in both v15 and v16. The v15 instance work fine, only the v16 has this problem.

Bilal Chehab

Have the Same issue for multiple version of Odoo on the same server. Did you find any solution ?

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
v16 --x-sendfile cli option
nginx odoo16features x-sendfile
Avatar
Avatar
1
Feb 23
3821
Odoo 16 Multi Worker Configuration
nginx proxy odoo16features
Avatar
0
Oct 22
4902
DeprecationWarning: The longpolling-port is a deprecated alias to the gevent-port option, please use the latter Solved
odoo16features
Avatar
Avatar
Avatar
Avatar
Avatar
5
Sep 25
24149
How to Add wizard under print button inside the form view.
odoo16features
Avatar
Avatar
Avatar
Avatar
3
Aug 25
3657
How to add @api.onchange in _get_view() method odoo 16
odoo16features
Avatar
Avatar
1
May 25
3557
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now