Odoo Nginx SSL Certificate

Certboot

Bismillah

Melanjutkan postingan saya sebelumnya, saya akan membahas Odoo Nginx SSL Secure Certificate Certboot.

Berikut langkah-langkahnya:

Install SSL Certificate

sudo apt-get install software-properties-common

sudo add-apt-repository ppa:certbot/certbot

sudo apt-get update

sudo apt-get install python-certbot-nginx

Renew the Certificate

sudo certbot --nginx certonly

crontab -e

00 00 * * * certbot renew

Reconfigure Nginx

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

upstream odoo {

  server 127.0.0.1:8069;

}

server {

    index index.html index.htm;

    server_name contoh.co.id www.contoh.co.id;

    location / {

        proxy_pass  http://backend-odoo;

        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;

        proxy_redirect off;

        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 https;

    }

    listen [::]:443 ssl ipv6only=on;

    listen 443 ssl;

    ssl_certificate /etc/letsencrypt/live/contoh.co.id/fullchain.pem;

    ssl_certificate_key /etc/letsencrypt/live/contoh.co.id/privkey.pem;

    include /etc/letsencrypt/options-ssl-nginx.conf;

    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

}

server {

    if ($host = contoh.co.id) {

        return 301 https://$host$request_uri;

    }

    listen 80 ;

    listen [::]:80 ;

    server_name contoh.co.id www.contoh.co.id;

    return 301 https://$host$request_uri;

}

Restart Nginx

sudo service nginx restart

Restart Odoo

sudo /etc/init.d/odoo restart