HTTPS with Let’s encrypt & Nginx

sudo apt-get -y install git bc
sudo git clone /opt/letsencrypt
sudo service nginx stop
cd /opt/letsencrypt
./letsencrypt-auto certonly --standalone
sudo ls /etc/letsencrypt/live/your_domain_name

Add to nginx config

listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/;
ssl_certificate_key /etc/letsencrypt/live/;

Add block to redirect http -> https

server {
listen 80;
return 301 https://$host$request_uri;


Leave a Reply

Your email address will not be published. Required fields are marked *