In our Odoo image you can set up your domain to use an SSL certificate. What you must do is follow the steps below.
What we'll do is installing Certbot to install a free Let’s Encrypt certificate. To carry out these steps, it will be necessary to connect through SSH to the Odoo server that we have created and set it up as explained below.
SSL certificate installation manual
Depending on which Ubuntu distribution Odoo is on, one procedure or another will have to be done, then we leave you the steps.
For Ubuntu 16.04 and below
First of all we will have to add the repository for CertBot:
# add-apt-repository ppa:certbot/certbot
And then we install the following package:
# apt install certbot python-certbot-nginx
For Ubuntu 18.04, Ubuntu 20.04 and Ubuntu 22.04
If you are using our Odoo 11 image, Odoo 12, Odoo 13 are under an Ubuntu 18.04 installation and if you are using Odoo 14 or Odoo 15 it will be under Ubuntu 20.04. If you use Odoo 16 it will be under Ubuntu 22.04.
We will install the following packages:
# apt install certbot python3-certbot-nginx
SSL Certificate Manual Installation
First off, we have to add the repository for CertBot:
# add-apt-repository ppa:certbot/certbot
Afterwards, we install the following package:
# apt install python-certbot-nginx
Next, we have to modifty the Nging configuration file that is in /etc/nginx/sites-enabled/default and we edit it:
# nano /etc/nginx/sites-enabled/default
We have to change this:
server_name odoo.mycompany.com;
Adding www is optional, not compulsory:
server_name midominio.es www.midominio.es;
We save and restart the Nginx service:
# systemctl restart nginx
And eventually, we generate the certificate with the following:
# certbot --authenticator webroot -w /var/www/html/ --redirect --installer nginx -d midominio.es
If you have added www, you have to execute this one:
# certbot --authenticator webroot -w /var/www/html/ --redirect --installer nginx -d midominio.es -d www.midominio.es
SSL Certificate Automatic Installation
In order to automate the whole process, we have created a script to execute the installation with only one command. The script must be used in the following way:
# wget https://gitlab.com/clouding.io-tech.support/certbot-ssl-images/raw/master/odoo-nginx-ssl.sh
# chmod u+x odoo-nginx-ssl.sh
And to generate the certificate:
# ./odoo-nginx-ssl.sh [domain] [e-mail]
For instance:
# ./odoo-nginx-ssl.sh clouding.io no-reply@clouding.io
The e-mail must be operative and the domain must appoint to the server.