Advertisement
Justman10000

acme.sh

Jun 7th, 2023 (edited)
1,387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.94 KB | None | 0 0
  1. // To install
  2. export HOME=/root
  3. wget https://raw.githubusercontent.com/acmesh-official/acme.sh/refs/heads/master/acme.sh
  4. mkdir /etc/letsencrypt
  5. bash acme.sh --install --cert-home /etc/letsencrypt/live
  6. ln -fs /root/.acme.sh /home/acme
  7.  
  8. # Now reopen your terminal...
  9.  
  10. ## Shut down your webserver
  11. systemctl stop apache2
  12. systemctl stop nginx
  13. systemctl stop caddy
  14. # or
  15. caddy stop
  16.  
  17. domain=MY_DOMAIN
  18.  
  19. # Getting certs
  20. ## Standalone (Syntax: domain.tld) (Includes only the main domain, no subdomains) (No domain authendification required)
  21. acme.sh --server letsencrypt --issue --domain $domain --standalone \
  22.     --cert-file /etc/letsencrypt/live/${domain}_ecc/cert.pem \
  23.     --key-file /etc/letsencrypt/live/${domain}_ecc/privkey.pem \
  24.     --fullchain-file /etc/letsencrypt/live/${domain}_ecc/fullchain.pem
  25. ## Wildcard (Syntax: *.domain.tld) (Includes only subdomains, not the main domain) (Domain authendification required)
  26. acme.sh --server letsencrypt --issue --domain *.$domain --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please \
  27.     --cert-file /etc/letsencrypt/live/${domain}_ecc/cert.pem \
  28.     --key-file /etc/letsencrypt/live/${domain}_ecc/privkey.pem \
  29.     --fullchain-file /etc/letsencrypt/live/${domain}_ecc/fullchain.pem
  30.  
  31. # Renew certs
  32. ## Wildcard
  33. acme.sh --server letsencrypt --renew --domain *.$domain --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please
  34.  
  35. ## For renewing domains after requesting for wildcards
  36. mv /etc/letsencrypt/live/${domain}_ecc/$domain.cer /etc/letsencrypt/live/$domain/cert.pem
  37. mv /etc/letsencrypt/live/${domain}_ecc/$domain.key /etc/letsencrypt/live/$domain/privkey.pem
  38. mv /etc/letsencrypt/live/${domain}_ecc/fullchain.cer /etc/letsencrypt/live/$domain/fullchain.pem
  39.  
  40. ## Now that the certificate(s) have been requested, restart your webserver:
  41. systemctl start apache2
  42. systemctl start nginx
  43. systemctl start caddy
  44. # or
  45. caddy start
  46.  
  47. // To uninstall
  48. rm -r /home/acme.sh /root/.acme.sh /usr/local/bin/acme.sh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement