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 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 [email protected]
The e-mail must be operative and the domain must appoint to the server.