2

I am on Odoo 14 too, I've tried this config in nginx and Odoo but not work, the requests to longpolling/ don't work, always I get 502 bad gateway, I reviewed some post related but don't work. Is there an error in the configuration files? My files config are: nginx/sites-available/mydomain.com.conf

 upstream odoo {
  server 127.0.0.1:8069;
 }
 
 upstream odoochat {
  server 127.0.0.1:8072;
 }
 
 server {
  listen 80;
  server_name www.my_domain.com my_domain.com;
  proxy_read_timeout 720s;
  proxy_connect_timeout 720s;
  proxy_send_timeout 720s;
 
 # Proxy headers
  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;
  access_log /var/log/nginx/odoo.access.log;
  error_log /var/log/nginx/odoo.error.log;
 
  location /longpolling {
    proxy_pass http://odoochat/longpolling;
  }
 
 # Handle / requests
  location / {
    proxy_redirect off;
    proxy_pass http://odoo;
  }
 
 # Cache static files
  location ~* /web/static/ {
     proxy_cache_valid 200 90m;
     proxy_buffering on;
     expires 864000;
     proxy_pass http://odoo;
  }
 
 # Gzip
  gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
  gzip on;
 }

/odoo/odoo.conf:

[options]
addons_path = /usr/lib/python3/dist-packages/odoo/addons
admin_passwd = password-admin
csv_internal_sep = ,
data_dir = /var/lib/odoo/.local/share/Odoo
db_host = False
db_maxconn = 64
db_name = False
db_password = False
db_port = False
db_sslmode = prefer
db_template = template0
db_user = odoo
dbfilter =
demo = {}
email_from = False
geoip_database = /usr/share/GeoIP/GeoLite2-City.mmdb
http_enable = True
http_interface =
http_port = 8069
import_partial =
limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 120
limit_time_real = 240
limit_time_real_cron = -1
list_db = True
log_db = False
log_db_level = warning
log_handler = :INFO
log_level = info
logfile = /var/log/odoo/odoo-server.log
max_cron_threads = 2
osv_memory_age_limit = False
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 = False
upgrade_path =
without_demo = False
longpolling_port = 8072
xmlrpc_port = 8069
workers = 2
xmlrpc_interface = 127.0.0.1
netrpc_interface = 127.0.0.1
Kenly
  • 24,317
  • 7
  • 44
  • 60
  • Just to make sure.... you say your nginx config file is in sites-available directory. Have you linked it to sites-enabled? If not it doesn't work. – ex4 Feb 10 '21 at 16:53
  • 2
    Can you try changing `proxy_pass http://odoochat/longpolling` for `proxy_pass http://odoochat`? Everything else looks fine. – Arkanoid Mar 02 '21 at 23:50
  • I had the same problem and the issue was that the 8072 port was not exposed from Docker container – Dragos Vasile Jul 21 '21 at 13:14
  • I had exactly the salame problem, after real and edites correcto the Conf files, I realized that the 8072 Port las not exponed from my Docker container.... :-/ – Pablo Alejandro Alandia Nov 06 '22 at 16:40

1 Answers1

0

i solve the problem adding this attributes in etc/nginx/sites-available/odoo.conf

  proxy_redirect off;
  proxy_pass http://0.0.0.0:80;

Notice the proxy pass is not http://localhost:8069 i changed for :80