Have started a new Odoo server on Ubuntu Linux. Used a script by Yenthe Van Ginekken (probably the most popular one):
sudo wget https://raw.githubusercontent.com/Yenthe666/InstallScript/11.0/odoo_install.sh
No fancy modules. After installing SSL cert(using Certbot) I realised that Discuss & Chat apps are not working. So I updated my config (workers=4, proxy mode is true) as well as Nginx config.
Odoo config:
[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
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;
}
The weird thing is that when I check the 8072 port(using lsof -i :8072
) nothing is listening there...
Ok, I have spent some time on it and got a solution. Haven't really found the answer why long polling was not working with the proper settings - that is why I am going to leave the question open.
I have basically replaced the original nginx config with the simple proxy reverse config without HTTPS:
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.
}
Then I simply used Certbot (https://certbot.eff.org/) and choose the option to redirect(that is the last point). Config generated by Certbot looks different but it works. Will test it on Monday on a different website and produce a tutorial.