Odoo - 没有进程正在监听长轮询端口 + 可能的解决方案

Pio*_*osz 5 nginx long-polling odoo odoo-11

在 Ubuntu Linux 上启动了一个新的 Odoo 服务器。使用了 Yenthe Van Ginekken 的脚本(可能是最受欢迎的):

sudo wget https://raw.githubusercontent.com/Yenthe666/InstallScript/11.0/odoo_install.sh
Run Code Online (Sandbox Code Playgroud)

没有花哨的模块。安装 SSL 证书(使用 Certbot)后,我意识到 Discuss & Chat 应用程序无法正常工作。所以我更新了我的配置(workers=4,代理模式为 true)以及 Nginx 配置。

奥多配置:

[options]
addons_path = /odoo/odoo-server/addons,/odoo/custom/addons
admin_passwd = pwd
csv_internal_sep = ,
data_dir = /odoo/.local/share/Odoo
db_host = False
db_maxconn = 64
db_name = False
db_password = False
db_port = False
db_sslmode = prefer
db_template = template1
db_user = False
dbfilter =
demo = {}
email_from = False
geoip_database = /usr/share/GeoIP/GeoLite2-City.mmdb
http_enable = True
http_interface =
http_port = 8070
import_partial =
limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 600
limit_time_real = 1200
limit_time_real_cron = -1
list_db = True
log_db = False
log_db_level = warning
log_handler = :INFO
log_level = info
logfile = /var/log/cier/cier-server.log
logrotate = False
longpolling_port = 8072
max_cron_threads = 1
osv_memory_age_limit = 1.0
osv_memory_count_limit = False
pg_path = None
pidfile = None
proxy_mode = True
reportgz = False
server_wide_modules = web
smtp_password = False
smtp_port = 25
smtp_server = localhost
smtp_ssl = False
smtp_user = False
syslog = False
test_commit = False
test_enable = False
test_file = False
test_report_directory = False
translate_modules = ['all']
unaccent = False
without_demo = False
workers = 8
Run Code Online (Sandbox Code Playgroud)

nginx:

#odoo server
upstream odoo {
 server 127.0.0.1:8070;
}
upstream odoochat {
 server 127.0.0.1:8072;
}

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

server {
 listen 443;
 server_name www.onet.pl;
 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;

 # SSL parameters
 ssl on;
# listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/onet.pl/fullchain.pem; # managed$
    ssl_certificate_key /etc/letsencrypt/live/onet.pl/privkey.pem; # manag$
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
 # log
 access_log /var/log/nginx/odoo.access.log;
 error_log /var/log/nginx/odoo.error.log;

 # Redirect longpoll requests to odoo longpolling port
 location /longpolling {
 proxy_pass http://odoochat;
 }

 # Redirect requests to odoo backend server
 location / {
   proxy_redirect off;
   proxy_pass http://odoo;
 }

location ~*  \.(jpg|jpeg|png|gif|ico|css|js)$ {
proxy_pass http://odoo;

expires 365d;
    }
 # common gzip
 gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
 gzip on;
}
Run Code Online (Sandbox Code Playgroud)

奇怪的是,当我检查 8072 端口(使用lsof -i :8072)时,没有任何东西在那里监听......


好的,我已经花了一些时间并得到了解决方案。还没有真正找到为什么长轮询不能在正确的设置下工作的答案——这就是为什么我要让这个问题保持开放。

我基本上已经用没有 HTTPS 的简单代理反向配置替换了原始的 nginx 配置:

server {

    listen 80;

    server_name http://yoursite.com;

     location / {

proxy_pass http://0.0.0.0:8069;

proxy_redirect off;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Proto $scheme;

proxy_read_timeout 3000000;

client_max_body_size 2000M;

}

# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.

}
Run Code Online (Sandbox Code Playgroud)

然后我只是使用 Certbot ( https://certbot.eff.org/ ) 并选择重定向选项(这是最后一点)。Certbot 生成的配置看起来不同,但它有效。周一将在不同的网站上对其进行测试并制作教程。