Updated: 4 November 2026 · Applies to: Odoo 20 on Ubuntu 24.04 LTS with Nginx and Certbot

Out of the box Odoo answers on http://SERVER-IP:8069, unencrypted. For real use put Nginx in front of it: Nginx serves your domain with a free Let's Encrypt certificate and passes requests to Odoo. This guide follows Odoo's own deployment documentation.

Before you start

1. Turn on proxy mode in Odoo

Proxy mode makes Odoo use the real client address and the real address of your site from the headers that Nginx sends. Open the configuration file:

sudo nano /etc/odoo/odoo.conf

Add these lines below [options]:

proxy_mode = True
http_interface = 127.0.0.1

proxy_mode = True must only be on when Odoo is behind a reverse proxy. http_interface = 127.0.0.1 makes Odoo listen only on the server itself, so nobody can bypass the proxy on port 8069. Save and restart:

sudo systemctl restart odoo

2. Install Nginx and Certbot

sudo apt update
sudo apt install -y nginx certbot python3-certbot-nginx

3. Create the Nginx site

Create /etc/nginx/sites-available/odoo:

upstream odoo {
    server 127.0.0.1:8069;
}

server {
    listen 80;
    server_name odoo.example.com;

    proxy_read_timeout 720s;
    proxy_connect_timeout 720s;
    proxy_send_timeout 720s;

    location / {
        proxy_set_header X-Forwarded-Host $http_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;
    }

    location /websocket {
        proxy_pass http://odoo;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-Host $http_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;
    }

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

The long timeouts of 720 seconds, the X-Forwarded-* headers and the compression types are taken from Odoo's sample configuration. The /websocket block keeps live features (chat and notifications) working.

sudo ln -s /etc/nginx/sites-available/odoo /etc/nginx/sites-enabled/odoo
sudo nginx -t
sudo systemctl reload nginx

4. Get the certificate

sudo certbot --nginx -d odoo.example.com

Choose to redirect HTTP to HTTPS. Certbot renews the certificate automatically; test with sudo certbot renew --dry-run. Then open https://odoo.example.com.

5. Close port 8069

With http_interface = 127.0.0.1 Odoo is already unreachable from outside. Also remove any firewall rule for 8069: sudo ufw delete allow 8069/tcp.

With several workers (heavier use)

The setup above uses Odoo's default multi-threaded server. For many users Odoo recommends the multi-process mode (workers in the configuration, rule of thumb: (number of CPU cores × 2) + 1). Then live chat runs on a separate port, 8072 by default, and Nginx has to send requests whose path starts with /websocket to it. Use the second upstream and the /websocket location from Odoo's deployment documentation, and change proxy_pass of that location to http://127.0.0.1:8072.

Protect the database manager

On an internet-facing server set list_db = False in /etc/odoo/odoo.conf, and if you host one company set dbfilter = ^yourdatabase$. Odoo's documentation strongly recommends disabling the Database Manager on internet-facing systems (How to reset the Odoo master password (admin_passwd)?).

Common problems

  • Login page works, but links or redirects use http:// or the wrong host: proxy_mode = True is missing, or the X-Forwarded-* headers are missing in Nginx.
  • 502 Bad Gateway: Odoo is not running (sudo systemctl status odoo) or listens on another port.
  • Live chat or notifications do not work: the /websocket block is missing, or, with workers, it does not point to port 8072.
  • Timeouts on big reports or imports: raise the three proxy_*_timeout values.

Frequently asked questions

Do I still need port 8069 open?
No. Only Nginx talks to it, on the server itself.

Can one Nginx serve several Odoo databases?
Yes. Use a separate server_name for each database together with dbfilter = ^%d$ ("%d" is the host name) in Odoo's configuration.

Official documentation: Odoo 20 documentation: Deploying Odoo.

Need a server for Odoo, or a hand with the setup?

Prefer a hand with the setup? Our engineers can do it for you: Hire an Expert, or use our on-demand server management.

Was this answer helpful?

Still stuck? Open a ticket