Running Odoo in HTTPS Using Nginx - by Latnok CD
Running Odoo in HTTPS Using Nginx - by Latnok CD
Normally you can run your odoo server with any open port inside your
server, you just need to specify it in your Odoo Config (by default is
8069). In this case, we are talking about http
Our concern is to add the “s” letter (stands for security) at the end of http (HTTPS) => you need to use the
443 port
Okey ! why we don’t just specify 443 port inside Odoo config ? and we get the connection.
Thinking smart
The https is not about the port number (even if it’s the conventional port to use for this kind of
communication) but more importantly the secure layer that is used on top of it, which give more protection
to your data and communication. That’s why we use a web server like Nginx
1/ Nginx and the other web servers comes to implement the ssl layer, secure the communication, manage
the data traffic and optimize performances. Is like a traffic cop
Traffic cop
2/ Is an open source Web server (there is a paid version named Nginx plus)
3/ Nginx has a good score in the benchmarks measuring the web server performances
1|Page
4/ Many people in Odoo community use it.
Once the installation finished, you can check its status by using this command:
#> sudo systemctl status nginx
You can check your installation by opening http://your_ip_address or localhost in your browser
There is many Certificate Authorities (CA) that afford different type of SSL certificates. In our case
we will use an open source one, afforded by Let’s Encrypt (free and open certificate authority)
1/ Install certbot :
#> sudo apt update
#> sudo apt install certbot
we can use an Nginx snippet for the mapping and use later in our files
#> sudo nano /etc/nginx/snippets/letsencrypt.conf
include snippets/letsencrypt.conf;
}
Now that you have the certificate files, you can edit your domain server
block /etc/nginx/sites-available/your_domain.conf as follows:
NB: You need to change the 8069 port by the port that you are using & your_domain.com by your
real domain
Restart Nginx :
sudo systemctl restart nginx
You can check the official page to know how do we get these numbers
Change XX by the size you want. Upload size can be a blocker when you try to add attatchments in
Odoo greater then 1MB
We can avoid this frightening error page by a personal and customized page. I will not explain
better then this article
4|Page