This guide shows how to put Odoo behind the Apache web server so users reach it at your domain name instead of an IP address and port 8069. It also covers adding a free SSL certificate. The steps are for Ubuntu and Debian. If you prefer Nginx, see How to Setup Odoo with Nginx as a Reverse Proxy in Ubuntu.
Prerequisites
Odoo: installed and running on port 8069
Domain: an A record pointing your domain to the server's IP address
Access: SSH access as a user with sudo privileges
Step 1: Install Apache
sudo apt update
sudo apt install -y apache2
Step 2: Enable the Proxy Modules
sudo a2enmod proxy proxy_http proxy_wstunnel headers
Step 3: Create a Virtual Host for Your Domain
Create a new file in the sites-available directory. Replace example.com with your domain throughout:
sudo tee /etc/apache2/sites-available/example.com.conf > /dev/null <<'EOF'
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /websocket ws://127.0.0.1:8072/websocket
ProxyPassReverse /websocket ws://127.0.0.1:8072/websocket
ProxyPass / http://127.0.0.1:8069/
ProxyPassReverse / http://127.0.0.1:8069/
</VirtualHost>
EOF
The /websocket lines handle live chat and notifications in Odoo 16 and newer when Odoo runs with workers. On older versions, or when workers are not configured, you can leave them in place.
Step 4: Enable the Site
Enable your new site, disable Apache's default site, then test the configuration:
sudo a2ensite example.com.conf
sudo a2dissite 000-default.conf
sudo apache2ctl configtest
If the test returns Syntax OK, reload Apache:
sudo systemctl reload apache2
Step 5: Turn On Proxy Mode in Odoo
Odoo needs proxy_mode enabled to see the real visitor address and generate correct links. Open your Odoo configuration file, often /etc/odoo.conf, and make sure this line is under [options]:
proxy_mode = True
Restart Odoo. The service name depends on your installation:
sudo systemctl restart odoo
Step 6: Add a Free SSL Certificate
Install Certbot and request a Let's Encrypt certificate. Certbot will create the HTTPS virtual host and set up the redirect from HTTP for you:
sudo apt install -y certbot python3-certbot-apache
sudo certbot --apache -d example.com -d www.example.com
Step 7: Test
Open https://example.com in your browser. You should see the Odoo login page. Once that works, you can block direct access to port 8069 in your firewall so users always go through Apache.
Next Steps
If you would rather not manage the web server yourself, our managed Odoo hosting includes domain, SSL and reverse proxy setup.


