This guide walks you through securely deploying an Odoo application on a Debian 11 server behind Nginx, with HTTPS enabled via Let's Encrypt.
We'll use a sample subdomain: your-subdomain.example.com — Make sure to replace this with your actual domain or subdomain.
Begin by installing Nginx, Certbot, and the Certbot Nginx plugin:
sudo apt update
sudo apt install nginx certbot python3-certbot-nginx -yapt update: Refreshes the package list from repositories.
apt install nginx: Installs the Nginx web server.
apt install certbot python3-certbot-nginx: Installs Certbot and its Nginx plugin to handle SSL certificates automatically.
Create a new Nginx site configuration file:
sudo nano /etc/nginx/sites-available/your-subdomain.example.com Paste the following configuration, updating your-subdomain.example.com with your actual subdomain:
server {
server_name your-subdomain.example.com;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
client_max_body_size 200m;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
access_log /var/log/nginx/odoo-access.log;
error_log /var/log/nginx/odoo-error.log;
location / {
proxy_pass http://127.0.0.1:8069;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location ~ /.well-known/acme-challenge {
allow all;
}
listen 80;
} Enable the newly created configuration:
sudo ln -s /etc/nginx/sites-available/your-subdomain.example.com /etc/nginx/sites-enabled/Then test and reload Nginx:
sudo nginx -t sudo systemctl reload nginxln -s: Creates a symbolic link to enable the site.
nginx -t: Tests for syntax errors in your config.
systemctl reload nginx: Reloads Nginx to apply changes.
If using UFW (Uncomplicated Firewall), allow Nginx traffic:
sudo ufw allow 'Nginx Full'Port 80 (HTTP)
Port 443 (HTTPS)
Use Certbot to obtain and configure the SSL certificate:
sudo certbot --nginx -d your-subdomain.example.com Automatically fetches a free SSL certificate from Let's Encrypt.
Updates your Nginx config for HTTPS.
Sets up automatic HTTP → HTTPS redirection.
Let’s ensure SSL will renew automatically:
sudo certbot renew --dry-runYour Odoo application is now live and securely accessible at:
👉 https://your-subdomain.example.com
It’s protected with a Let's Encrypt SSL certificate and routed through Nginx for better performance, security, and scalability.
Need help deploying multiple Odoo instances or hardening your production environment?
Let’s connect on Peerlist or LinkedIn!
0
5
0