How to Install Letsencrypt Certificates With Certbot in Ubuntu 16.04

by admin Date: 02-10-2018 ubuntu linux ssl certbot letsencrypt

Install Certbot's Nginx package with apt-get.

sudo apt-get install python-certbot-nginx
sudo certbot -i nginx -a webroot -w /var/www/ -d

edit the nginx config file for /etc/nginx/sites-available/default.

server {
        listen 443 ssl;

	ssl_certificate /etc/letsencrypt/live/;
	ssl_certificate_key /etc/letsencrypt/live/;

        location / {
            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;
            proxy_set_header X-Forwarded-Port 443;
            proxy_set_header Host $host;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

test renew

certbot renew --dry-run

Create a file /root/

systemctl reload nginx

Make it executable:

chmod +x /root/

Edit cron:

sudo crontab -e

And add the line:

20 3 * * * certbot renew --noninteractive --renew-hook /root/
by admin Date: 02-10-2018 ubuntu linux ssl certbot letsencrypt hits : 881  

Related Posts

We use our own cookies and third-party cookies to improve our services, show products based on your preferences, analyse the browsing habits of our users, and enable interaction with social networks. Continuing to browse our sites implies full acceptance of their use. You can change your cookie setting or get more information here: Cookies policy .