Odoo 19 production deployment is more than running odoo-bin on a server. You need a safe database user, worker processes, HTTPS, working live updates, and backups you have tested.
In this guide, you will learn to deploy Odoo 19 Community on Ubuntu 24.04 with PostgreSQL, Nginx, and multi-process workers. Also, you will learn to set up Nginx for the Odoo WebSocket route, secure the database manager, back up the database and filestore, and run a restore test.
What You Need for Odoo 19 Production Deployment
Before you start, make sure to make these things ready:
- A fresh Ubuntu 24.04 VPS with root or sudo access.
- A domain name with an A record that points to the VPS.
- Ports 80 and 443 open.
If you still need a server, a Linux VPS with NVMe storage and full root access is a good fit for this setup.
How to Size an Odoo Server for a Small Team
There is no single RAM size that fits every Odoo server. The right size depends on how many people use it and what they do. Our example is a team of 20 users on a VPS with 4 vCPU and 8 GB RAM.
Odoo gives two simple rules. One worker can serve about 6 users at the same time. And the most workers you should run is (CPU x 2) + 1.
- 20 users / 6 = about 4 workers.
- Maximum for 4 CPUs:
(4 x 2) + 1 = 9 workers.
- We choose
workers = 4, plus 1 cron thread.
A light worker uses about 150 MB of RAM. A heavy worker uses about 1 GB. A good estimate is that 1 in 5 requests (20%) is heavy.
With 4 workers, Odoo needs about 1.3 GB of RAM for the workers alone:
4 x ((0.8 x 150 MB) + (0.2 x 1024 MB)) = about 1.3 GB for Odoo workers
PostgreSQL, Nginx, and the OS also use RAM. That is why 8 GB is a comfortable size for this example. Your numbers may be different, so you will learn to measure them later in this guide.
To learn more about picking a server size, you can check our VPS sizing guide.
Step 1: Prepare the Server
First, you must run the system update and set up a basic firewall with the commands below:
sudo apt update && sudo apt upgrade -ysudo apt install ufw curl gnupg -ysudo ufw allow OpenSSHsudo ufw allow 80/tcpsudo ufw allow 443/tcpsudo ufw enable
Ports 8069 and 8072 stay closed. Only Nginx talks to them on localhost.
Step 2: Install PostgreSQL
Odoo saves all its data in a PostgreSQL database. Use the commands below to install PostgreSQL from the Ubuntu 24.04 repository:
sudo apt install postgresql -ysudo systemctl enable --now postgresqlpsql --version
Odoo 19 needs version 13 or newer. Ubuntu 24.04 installs a PostgreSQL version that Odoo 19 supports.
Step 3: Install Odoo 19
At this point, you can add the official Odoo 19 repository and install the package with the commands below:
wget -q -O - https://nightly.odoo.com/odoo.key | sudo gpg --dearmor -o /usr/share/keyrings/odoo-archive-keyring.gpgecho 'deb [signed-by=/usr/share/keyrings/odoo-archive-keyring.gpg] https://nightly.odoo.com/19.0/nightly/deb/ ./' | sudo tee /etc/apt/sources.list.d/odoo.listsudo apt-get update && sudo apt-get install odoo -y
The package creates the odoo system user, the service, and the config file /etc/odoo/odoo.conf.
Also, it creates a PostgreSQL user named odoo. You can check it with:
sudo -u postgres psql -c '\du'
Odoo uses wkhtmltopdf to turn reports into PDF files. For headers and footers to work, you need version 0.12.6. If you print reports, you can install the patched 0.12.6 build from the wkhtmltopdf project.
Note: The nightly repository gives you the Community edition only. Enterprise packages need a paid account, and you can download them from Odoo.
Step 4: Secure the PostgreSQL Role
Now you should follow three simple rules to keep your database safe:
- The database user must not be a superuser.
- The master password must be random.
- The database manager must be blocked on public servers.
Use the command below to set the role to be safe, with no superuser, no role creation, and no database creation:
sudo -u postgres psql -c "ALTER ROLE odoo NOSUPERUSER NOCREATEDB NOCREATEROLE;"
Then, create the production database owned by this role:
sudo -u postgres createdb -O odoo odoo19_prod
Odoo connects to PostgreSQL through a local socket on the same server. So PostgreSQL stays off the network, and you don't need a database password. You can check it with:
sudo -u postgres psql -c '\l odoo19_prod'sudo ss -ltnp | grep 5432
You should see PostgreSQL only on 127.0.0.1, or only on a socket.
Note: The role owns its database because Odoo must change tables when you install or update modules. A stricter setup with a separate owner would stop Odoo from doing this, so most teams don't use it.
Step 5: Configure Odoo for Production
Now you can set up Odoo to run safely in production. First, generate a random master password and keep it in your password manager:
python3 -c 'import base64, os; print(base64.b64encode(os.urandom(24)).decode())'
Then, edit the config file to configure a fixed database, workers, and memory limits:
sudo nano /etc/odoo/odoo.conf
[options]admin_passwd = PUT_THE_RANDOM_VALUE_HEREdb_host = Falsedb_port = Falsedb_user = odoodb_password = Falsedb_name = odoo19_proddbfilter = ^odoo19_prod$list_db = False http_interface = 127.0.0.1http_port = 8069gevent_port = 8072proxy_mode = True data_dir = /var/lib/odoologfile = /var/log/odoo/odoo-server.log workers = 4max_cron_threads = 1limit_memory_soft = 1073741824limit_memory_hard = 1342177280limit_time_cpu = 600limit_time_real = 1200limit_request = 8192
Once you are done, save and close the file. Then, make sure the log folder exists, and set up the database. Use --without-demo=all to skip demo data. Demo data has default logins, so it must not be on a public server:
sudo systemctl stop odoosudo -u odoo /usr/bin/odoo -c /etc/odoo/odoo.conf -d odoo19_prod -i base --without-demo=all --stop-after-initsudo systemctl enable --now odoosudo systemctl status odoo --no-pager
If the /usr/bin/odoo path is different on your server, check it with which odoo.
Next, read the log file. Odoo is running in multi-process mode, so you should see the workers and the live chat process start:
sudo tail -n 50 /var/log/odoo/odoo-server.logsudo ss -ltnp | grep -E '8069|8072'
Both ports must show 127.0.0.1. If you see 0.0.0.0, fix http_interface before you proceed.
Step 6: Set Up Nginx and HTTPS
Odoo should not face the internet directly. You can install Nginx and configure it as a reverse proxy for Odoo. Also, you can get a free SSL certificate from Let's Encrypt, so your site runs on HTTPS.
First, install Nginx and Certbot with the following command:
sudo apt install nginx certbot python3-certbot-nginx -y
Then, create an HTTP-only file so Certbot can validate your domain:
sudo nano /etc/nginx/sites-available/odoo.conf
server { listen 80; server_name odoo.example.com; location / { return 301 https://$host$request_uri; }}
Once you are done, save and close the file. Then, enable the Odoo site in Nginx, remove the default site, check the config, and get your SSL certificate with the commands below:
sudo ln -s /etc/nginx/sites-available/odoo.conf /etc/nginx/sites-enabled/odoo.confsudo rm -f /etc/nginx/sites-enabled/defaultsudo nginx -t && sudo systemctl reload nginxsudo certbot certonly --nginx -d odoo.example.com
Now replace the file with the full production config. It sends normal traffic to Odoo and live chat traffic to the WebSocket port:
upstream odoo { server 127.0.0.1:8069;}upstream odoochat { server 127.0.0.1:8072;}map $http_upgrade $connection_upgrade { default upgrade; '' close;} server { listen 80; server_name odoo.example.com; location / { return 301 https://$host$request_uri; }} server { listen 443 ssl; http2 on; server_name odoo.example.com; ssl_certificate /etc/letsencrypt/live/odoo.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/odoo.example.com/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; ssl_session_timeout 30m; proxy_read_timeout 720s; proxy_connect_timeout 720s; proxy_send_timeout 720s; client_max_body_size 100m; access_log /var/log/nginx/odoo.access.log; error_log /var/log/nginx/odoo.error.log; location ^~ /web/database { return 404; } location /websocket { proxy_pass http://odoochat; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $http_host; 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; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains"; proxy_cookie_flags session_id samesite=lax secure; } location / { proxy_pass http://odoo; proxy_redirect off; proxy_set_header Host $http_host; 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; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains"; proxy_cookie_flags session_id samesite=lax secure; } gzip on; gzip_types text/css text/plain text/xml application/xml application/json application/javascript;}
Once you are done, check the Nginx config, reload Nginx, and confirm that your SSL certificate will renew by itself:
sudo nginx -t && sudo systemctl reload nginxsudo systemctl status certbot.timer --no-pager
Note: The http2 on; line needs Nginx 1.25.1 or newer. Ubuntu 24.04 comes with a version that supports it. If nginx -t shows an error, use listen 443 ssl http2; instead.
Why Odoo Needs a WebSocket Route
In multi-process mode, Odoo starts a separate live chat worker on gevent_port (8072). Normal requests still go to the normal workers on port 8069. So Nginx must send every path that starts with /websocket to port 8072. You also need proxy_mode turned on, so Odoo can read the real host, scheme, and IP from the Nginx headers.
This is the key part of an Odoo 19 Nginx WebSocket setup. If /websocket goes to port 8069 instead, the site still loads and you can still log in. But live features, like Discuss messages and notifications, will not work.
You can send a WebSocket request to your site, so you can check that Nginx sends /websocket to the live chat worker:
curl -i -N --http1.1 \ -H "Connection: Upgrade" -H "Upgrade: websocket" \ -H "Sec-WebSocket-Version: 13" -H "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \ -H "Origin: https://odoo.example.com" \ https://odoo.example.com/websocket
If you get a 101 Switching Protocols answer, the route works. Then, check it in your browser. Open Developer Tools, go to Network, and filter by WS. You should see a /websocket connection that stays open.
Step 7: Check the Database Manager Is Blocked
The Odoo database manager can create, copy, and delete databases. On a public server, nobody should be able to reach it. Run the command below to check that it is blocked:
curl -I https://odoo.example.com/web/database/manager
You should get a 404 from Nginx. Next, open this page and log in with the admin account you created:
https://odoo.example.com/web/login
Change the default admin login and password immediately. Never keep admin/admin.
Step 8: Measure Memory per Worker
Now you can measure your own server. Log in and use Odoo normally for 10 minutes; from there, open lists, run a report, and export some records. Then, run:
ps -u odoo -o pid,ppid,rss,etime,args --sort=-rssfree -h
rss is shown in KB. Divide it by 1024 to get MB. The parent process is the master. The other processes are the HTTP workers, the cron worker, and the gevent process.
For a better view of real use, run this while the team works:
watch -n 5 "ps -u odoo -o pid,rss,args --sort=-rss | head -n 10"
RSS counts shared memory once for each process that uses it. So if you add up all the rows, the total will be too high. Use free -h to see the real total.
Record your results like this with your values:
| Item |
Idle |
After 10 min of use |
Peak under load |
| One HTTP worker (MB) |
[MEASURE] |
[MEASURE] |
[MEASURE] |
| Cron worker (MB) |
[MEASURE] |
[MEASURE] |
[MEASURE] |
| Gevent process (MB) |
[MEASURE] |
[MEASURE] |
[MEASURE] |
Total used RAM, free -h (GB) |
[MEASURE] |
[MEASURE] |
[MEASURE] |
Use the real numbers from your own server to set limit_memory_soft and to decide if you need more RAM. Your results will change if you use different modules, have more data, or run heavy reports.
Watch for workers that Odoo kills because they pass the memory or time limits:
sudo grep -iE "memory limit|virtual memory|CPU time limit|Worker .* \(.*\) (alive|killed)" /var/log/odoo/odoo-server.log | tailsudo journalctl -k | grep -i "out of memory"
If you see many memory-limit restarts, increase the limits a little or add RAM. If you see kernel out-of-memory kills, lower workers.
Step 9: Tune PostgreSQL
Odoo stores all its data in PostgreSQL, so the way you set up the database has a big effect on speed. In this step, you must adjust a few PostgreSQL settings to match your server's RAM and CPU.
For this 8 GB example, where PostgreSQL and Odoo share the server, you can start with these values:
sudo nano /etc/postgresql/*/main/conf.d/odoo.conf
shared_buffers = 2GBeffective_cache_size = 5GBwork_mem = 16MBmaintenance_work_mem = 256MBmax_connections = 100
Restart PostgreSQL to apply your changes. Then, run the second command to check that shared_buffers shows the new value:
sudo systemctl restart postgresqlsudo -u postgres psql -c "SHOW shared_buffers;"
These numbers are starting points, not fixed rules. They follow common PostgreSQL advice, such as using about 25% of RAM for shared_buffers. After a week of real use, check your slow queries and adjust.
Step 10: Back Up the Database and Filestore
An Odoo backup has two parts. Both are needed:
- The PostgreSQL database.
- The filestore (attachments and files), in
/var/lib/odoo/filestore/odoo19_prod.
If you save only one, you cannot fully restore. It is recommended to copy backups to a remote server that the Odoo server cannot reach.
You can create the backup script with the commands below:
sudo mkdir -p /var/backups/odoo && sudo chmod 700 /var/backups/odoosudo nano /usr/local/bin/odoo-backup.sh
Add the following script to the file. This script backs up your Odoo database and filestore into one folder. It also deletes backups older than 7 days, then lists the newest files so you can check them.
#!/bin/bashset -euo pipefailDB=odoo19_prodDEST=/var/backups/odooSTAMP=$(date +%F_%H%M)sudo -u odoo pg_dump -Fc "$DB" > "$DEST/${DB}_${STAMP}.dump"tar -czf "$DEST/${DB}_filestore_${STAMP}.tar.gz" -C /var/lib/odoo/filestore "$DB"find "$DEST" -type f -mtime +7 -deletels -lh "$DEST" | tail -n 4
Once you are done, save and close the file. Then, run these commands to give the correct permissions to the script, test it once, and schedule it to run daily at 2:30 AM:
sudo chmod 700 /usr/local/bin/odoo-backup.shsudo /usr/local/bin/odoo-backup.shecho '30 2 * * * root /usr/local/bin/odoo-backup.sh >> /var/log/odoo-backup.log 2>&1' | sudo tee /etc/cron.d/odoo-backup
Then, copy the files off the server, for example with rsync to a remote host or object storage. A backup that lives only on the same VPS is not safe.
Step 11: Run a Restore Test
A backup is only real if you restored it. Do this test on the same server with a second database and a second port. It does not touch production.
LATEST_DB=$(ls -t /var/backups/odoo/odoo19_prod_2*.dump | head -n 1)LATEST_FS=$(ls -t /var/backups/odoo/odoo19_prod_filestore_*.tar.gz | head -n 1) sudo -u postgres createdb -O odoo restore_testsudo -u odoo pg_restore -d restore_test --no-owner "$LATEST_DB" sudo mkdir -p /var/lib/odoo/filestore/restore_testsudo tar -xzf "$LATEST_FS" -C /var/lib/odoo/filestore/restore_test --strip-components=1sudo chown -R odoo:odoo /var/lib/odoo/filestore/restore_test
Start a temporary Odoo on port 8070. Single-process mode is fine for this test:
sudo -u odoo /usr/bin/odoo -c /etc/odoo/odoo.conf -d restore_test \ --http-port=8070 --gevent-port=8073 --workers=0 --dbfilter='^restore_test$' &sleep 20curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:8070/web/login
You should get a 200. Next, open the test site through an SSH tunnel and log in. Then, check that your records and attachments open, such as a product image or an invoice PDF:
ssh -L 8070:127.0.0.1:8070 user@your-server-ip
Next, open the http://127.0.0.1:8070 page in your browser. When you are done, clean up the test:
sudo pkill -f "restore_test"sudo -u postgres dropdb restore_testsudo rm -rf /var/lib/odoo/filestore/restore_test
Write down your test result. Fill it in from your own test:
| Check |
Result |
| Dump size |
[MEASURE] |
| Filestore size |
[MEASURE] |
pg_restore time |
[MEASURE] |
| Login works on restored copy |
[YES/NO] |
| Attachments open |
[YES/NO] |
Step 12: Test a Login and a Long-Running Task
Do these final tests before you give the system to users.
1) Login test. Open https://odoo.example.com, log in, and check the lock icon. Watch the log for the line Login successful:
sudo tail -f /var/log/odoo/odoo-server.log | grep -i login
2) Live update test. Open Discuss in two browsers with two users. Send a message from one and check that the other receives it without a page refresh. This proves the WebSocket route.
3) Long request test. Import or export a large list, for example 50,000 contact records, or run a big report. Time it with the browser Network tab. The request must finish without a 502 or 504 from Nginx. This proves that the proxy timeouts (720s) and Odoo limits work together.
4) Cron test. Go to Settings > Technical > Scheduled Actions (turn on Developer Mode), pick a built-in job, and click Run Manually. Check the log:
sudo grep -i cron /var/log/odoo/odoo-server.log | tail
5) Worker restart check. While a long export runs, run ps -u odoo -o pid,rss,args in another terminal and see the memory of the worker. Compare it to your limits from Step 5.
If a request is killed, the log says which limit it hit. Increase only that limit, and only as much as you need.
Fixing Common Odoo Errors
Even with a careful setup, something can go wrong. Here are the most common problems you may see with your Odoo 19 server and quick fixes:
- 502 Bad Gateway: Odoo is not running. Run
sudo systemctl status odoo and read the log.
- Login loop or wrong redirects to http:
proxy_mode = True is missing, or X-Forwarded-Proto is not set in Nginx.
- No live updates or chat:
/websocket is not sent to port 8072, or the Upgrade headers are missing.
- "Database not found":
dbfilter or db_name does not match the real database name.
- Workers keep restarting: memory limits are too low for your modules. Check the log and measure again.
Conclusion
At this point, you have a working Odoo 19 server. It runs behind Nginx with HTTPS, uses WebSockets for live features, and has a tuned PostgreSQL database. It also has daily backups that you have tested with a restore.
Keep the system updated, review your logs and memory use regularly, and repeat the restore test after major changes. This will keep your server fast, safe, and ready for real work.
If you cannot check a step or finish a change safely, see what each PerLod support level covers. Basic support is included with every service. Hands-on work, such as server administration and incident help, needs a higher level. Do not assume it is included.
For more detailed information, you can check the official Odoo 19 documentation.