Configure Odoo with Nginx as a Reverse Proxy
3 min read
Odoo is one the of most popular business softwares in the world and it is packed with multiple useful modules like customer relationship management (CRM), point of sale, project management, inventory management, automated invoicing, accounting, e-commerce, inventory management and much more.
Odoo comes with a built-in web server, but in most cases it is recommended to have a reverse proxy in front of it which will act as an intermediary between the clients and the Odoo server.
This guide provides instructions on how to use Nginx as a SSL termination and reverse proxy to Odoo.
Make sure that you have met the following prerequisites before continuing with this tutorial:
- You have Odoo installed, if not you can find the instructions here
- You have a domain name pointing to your Odoo installation. In this article we will use
- You have Nginx installed, if not check this guide.
- You have a SSL certificate installed for your domain. You can install a free Let’s Encrypt SSL certificate by following this guide.
Configure Nginx as a Reverse Proxy
Using a reverse proxy gives you a lot of benefits such as Load Balancing, SSL Termination, Caching, Compression, Serving Static Content and more.
In this example we will configure SSL Termination, HTTP to HTTPS redirection, cache the static files and enable GZip compression.
Below is a sample nginx configuration file (server block ) that you can use for your Odoo installation. All the HTTP requests will be redirected to HTTPS .
Open your text editor and create the following file:
sudo nano /etc/nginx/sites-enabled/odoo.example.com
Don’t forget to replace odoo.example.com with your Odoo domain and set the correct path for the SSL certificate files.
Once you are done save the file and restart the Nginx service with:
sudo systemctl restart nginx
Change the binding interface
This step is optional, but it is a good security practice.
By default, Odoo server listens to port
8069 on all interfaces. If you want to disable direct access to your Odoo instance open the Odoo configuration file and add the following two lines at the end of the file:
xmlrpc_interface = 127.0.0.1 netrpc_interface = 127.0.0.1
Save the configuration file and restart the Odoo server for the changes to take effect:
systemctl restart odoo
In this tutorial you learned how to configure Nginx as a Proxy to your Odoo application. You can also read about How to Setup Automatic Odoo Backups