How to Configure Odoo with Nginx as Reverse Proxy?

Odoo is one the of most popular business software in the world and is packed with multiple useful modules like Customer Relationship Management (CRM), Point of Sale, Project Management, Inventory Management, Automated Invoicing, Accounting, E-commerce, and much more.

This blog provides instructions on how to use Nginx as a reverse proxy to Odoo.

- In order to access your Odoo application only by using your domain name, without the port number in the URL, we need to set up Nginx as a reverse proxy.

- Before installing the Nginx web server, make sure that there is no other web server like Apache installed on the VPS. If Apache web server is running, stop it:

systemctl stop apache2

and remove it:

apt-get purge apache2*apt autoremove

NGINX web server

- Nginx is free and open source web server/software, which can also be used as a reverse proxy, load balancer and HTTP cache. A large fraction of web servers use NGINX.

- Install NGINX on Ubuntu

On Ubuntu (and other Debian based Linux distributions), run:

sudo apt-get updatesudo apt-get install nginx

- Start NGINX

Start the nginx service with the following command:

sudo service nginx start

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, so if you want to disable the direct access to your Odoo instance, open the Odoo configuration and add the following two lines at the end of the file:

/etc/odoo.conf

xmlrpc_interface = 127.0.0.1netrpc_interface = 127.0.0.1

- Save the configuration file and restart the Odoo server for the changes to take effect:

systemctl restart odoo

Configure NGINX

- Edit the current nginx server block about the old domain or create a new server block if it is not created yet.