Skip to content

Instantly share code, notes, and snippets.

@lohithn4
Last active December 20, 2022 15:19
Show Gist options
  • Save lohithn4/cc3c86c23b5c70a9ede4a75488913cf0 to your computer and use it in GitHub Desktop.
Save lohithn4/cc3c86c23b5c70a9ede4a75488913cf0 to your computer and use it in GitHub Desktop.
lets encrypt certbot
https://tecadmin.net/install-lets-encrypt-create-ssl-ubuntu/
$ apt-get update
$ sudo apt-get install certbot
$ apt-get install python3-certbot-nginx
$ sudo certbot --nginx -d example.com -d www.example.com
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
server_name example.com www.example.com;
listen 443 ssl; # managed by Certbot
# RSA certificate
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
# Redirect non-https traffic to https
if ($scheme != "https") {
return 301 https://$host$request_uri;
} # managed by Certbot
}
$crontab -e
0 12 * * * sudo /usr/bin/certbot renew --quiet --standalone --pre-hook "service nginx stop" --post-hook "service nginx restart"
https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-20-04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment