Enable Dark Mode!
how-to-configure-odoo-with-nginx-as-reverse-proxy.png
By: Sreejith

How to Configure Odoo with Nginx as Reverse Proxy?

Technical

Odoo is one of the most popular business management ERP software in the world. Moreover, having a modular approach to option in the company the platform is packed with multiple useful modules such as 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.
Initially, in order to access your Odoo application only by using your domain name, and 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 such as Apache installed on the VPS. If the Apache web server is running, stop it using the following command:
systemctl stop apache2
Furthermore, you can remove it using the following command:
apt-get purge apache2*
apt autoremove
As we have stopped and removed other servers from functioning now let's move on to installing aspects of NGINX
NGINX web server
- Nginx is a free and open source web server/software, which can also be used as a reverse proxy, load balancer and HTTP cache.  Additionally, a large fraction of web servers use NGINX.
Now lets under tsnd how to install NGINX in ubuntu or other Debian based Linux distributions

- Install NGINX  on Ubuntu
For installing NGINX on Ubuntu (and other Debian based Linux distributions), run the following command:
sudo apt-get update
sudo apt-get install nginx
- Start NGINX
Start the Nginx service with the use of the following command:
sudo service nginx start

Change the binding interface

- Although this step is optional, it is a good security practice. Moreover, 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 of command at the end of the file:

sudo nano /etc/odoo.conf
xmlrpc_interface = 127.0.0.1
netrpc_interface = 127.0.0.1

- Now save the configuration file and restart the Odoo server for the changes to take effect using the following code:

systemctl restart odoo

As the NGINX is installed and the binding interface is changed let's now move on to configuring it in the next section.

Configure NGINX

- Initially edit the current Nginx server block in the old domain or create a new server block if it is not created yet.

- Now add the following lines of code to configure NGINX:


sudo nano /etc/nginx/sites-enabled/default


server {
    server_name testing.com 111.111.111.111; //replace ip and server name with your domain and ip
    listen 80;
    access_log /var/log/nginx/testing-access.log;
    error_log /var/log/nginx/testing-error.log;
    location /longpolling {
        proxy_connect_timeout   3600;
        proxy_read_timeout      3600;
        proxy_send_timeout      3600;
        send_timeout            3600;
        proxy_pass http://127.0.0.1:8072;
}
    location / {
        proxy_connect_timeout   3600;
        proxy_read_timeout      3600;
        proxy_send_timeout      3600;
        send_timeout            3600;
        proxy_pass http://127.0.0.1:8069/;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    gzip on;
    gzip_min_length 1000;
}
upstream odoo {
server 127.0.0.1:8069 weight=1 fail_timeout=0;
}
upstream odoo-im {
server 127.0.0.1:8072 weight=1 fail_timeout=0;
}

As the NGINX is configured lets now restart the server for the configuration to be effective.

Restart NGINX

- Restart the Nginx service using the following code for the changes to take effect:

service nginx restart
Following the above-mentioned steps will help you to easily configure the Odoo platform with Nginx as Reverse Proxy


If you need any assistance in odoo, we are online, please chat with us.



4
Comments

hadhemi

Hello, I follow ur steps but after entering domain name showing nginx home page.

25/12/2022

-

9:22PM

Dwarkanath Bari

Hello i made a changes link domain with odoo and now trying to configure my domain with https but showing error like :nginx: [emerg] no "ssl_certificate_key" is defined for certificate "/etc/ssl/certs/surveyspan_com.crt" nginx: configuration file /etc/nginx/nginx.conf test failed please help me

14/11/2019

-

5:57AM

Adam Phillips

How do I configure multiple websites on odoo with nginx. I've done this but nginx is giving an error with the second conf file

12/04/2020

-

5:05PM

Dwarkanath

Hello, I follow ur steps but after entering domain name showing nginx home page.

07/10/2019

-

12:12AM



Leave a comment



whatsapp_icon
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message