Let's Encrypt is a non-profit certificate authority that provides free X.509 certificates for TLS encryption through an automated process designed to replace the current complex process of manually creating, verifying, signing, installing and updating certificates for secure websites. Let's Encrypt recently introduced a Wildcard certificate for your domain, now you can use ssl without wildcards for your domain and for multiple subdomains with just one SSL certificate.

This guide will work with Linux distributions such as CentOS, Ubuntu, Debian.
Installation is done using Ubuntu OS as an example, to install git on CentOS OS, you need to use package managers yum, instead of apt-get.

  • Install the acme.sh script:
cd /root  
sudo apt-get install socat git  
git clone https://github.com/Neilpang/acme.sh.git  
cd ./acme.sh  
./acme.sh --install

After installation, a cron job will be created to automatically renew the certificate.

[Tue Jun 8 14:22:33 MSK 2021] Installing cron job
6 0 * * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null  
[Tue Jun 8 14:22:33 MSK 2021] Good, bash is found, so change the shebang to use bash as preferred.
[Tue Jun 8 14:22:34 MSK 2021] OK


  • Requesting a release:
bash acme.sh --issue -d testfrnx.ru -d *.testfrnx.ru --dns --force --yes-I-know-dns-manual-mode-enough-go-ahead-please  

Instead of testfrnx.ru you must specify your domain.

  • The script will generate 2 TXT records to be added to DNS panel:
[Tue Jun 8 14:23:11 MSK 2021] Domain: '_acme-challenge.testfrnx.ru'
[Tue Jun 8 14:23:11 MSK 2021] TXT value: 'GCgAc4Q1Ur4Iv5A-SFhaZ6as-IyuIbfcm7FnUq3Qxs'
...
[Tue Jun 8 14:23:12 MSK 2021] Domain: '_acme-challenge.testfrnx.ru'
[Tue Jun 8 14:23:12 MSK 2021] TXT value: 'dA6AcK4oR2VOIuD_i7zdNn6RZXXBJORpZWlhDOmk96A'

When adding a record, you should add a period at the end of the record name. For example:

TXT record _acme-challenge.testfrnx.ru.  
value : "dA6AcK4oR2VOIuD_i7zdNn6RZXXBJORpZWlhDOmk96A"  
TXT record _acme-challenge.testfrnx.ru.  
value : "GCgAc4Q1Ur4Iv5A-SFhaZ6as-IyuIbfcm7FnUOq3Qxs"  

file

  • Checking to see if the DNS records have been updated
dig txt +short _acme-challenge.testfrnx.ru  
"GCgAc4Q1Ur4Iv5A-SFhaZ6as-IyuIbfcm7FnUOq3Qxs"
"dA6AcK4oR2VOIuD_i7zdNn6RZZXXBJORpZWlhDOmk96A"
  • After updating the DNS, resume issuing the certificate:
bash acme.sh --renew -d testfrnx.ru -d *.testfrnx.ru --dns --force --yes-I-know-dns-manual-mode-enough-go-ahead-please  
[Tue Jun 8 15:26:45 MSK 2021] Renew: 'testfrnx.ru'
[Tue Jun 8 15:26:46 MSK 2021] Using CA: https://acme-v02.api.letsencrypt.org/directory
[Tue Jun 8 15:26:46 MSK 2021] Multi domain='DNS:testfrnx.ru,DNS:*.testfrnx.ru'
[Tue Jun 8 15:26:46 MSK 2021] Getting domain auth token for each domain
[Tue Jun 8 15:26:46 MSK 2021] Verifying: testfrnx.ru
[Tue Jun 8 15:26:50 MSK 2021] Success
[Tue Jun 8 15:26:50 MSK 2021] Verifying: *.testfrnx.ru
[Tue Jun 8 15:26:54 MSK 2021] Success
[Tue Jun 8 15:26:54 MSK 2021] Verify finished, start to sign.
[Tue Jun 8 15:26:54 MSK 2021] Lets finalize the order.
[Tue Jun 8 15:26:54 MSK 2021] Le_OrderFinalize='https://acme-v02.api.letsencrypt.org/acme/finalize/126277849/10255533047'
[Tue Jun 8 15:26:55 MSK 2021] Downloading cert.
[Tue Jun 8 15:26:55 MSK 2021] Le_LinkCert='https://acme-v02.api.letsencrypt.org/acme/cert/03b7103ef19e6ed4f7ed37a88639dfc16fda'
[Tue Jun 8 15:26:56 MSK 2021] Cert success.
-----BEGIN CERTIFICATE-----
MIIFKzCCBBOgAwIBAgISA7cQPvGebtT37TeohjnfwW/aMA0GCSqGSIb3DQEBCwUA  
MDIxCzAJBgNVBAYTAlVTMTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQD  
EwJSMzAeFw0yMTA2MDgxMTI2NTVaFw0yMTA5MDYxMTI2NTVaMBYxFDASBgNVBAMT  
C3Rlc3R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CLqqek/QI9oy+A0QIdmaI3tEMiDmtK5pbnATWlmKUP6eUErZZTuaioE4m  
vTYOXId0nrMeZSa/N62mSJfpuQBfk3K1xiYVGxci6WwbB4PmfZX+hOQNAFn+zoWQ  
Rl3kO4CDbCxsaXCzxz1BW65arox2vkAlXVHznLxzTBRa5ysJi6U6xWGg8VpUsPwF  
1O/2l90+LYCsQ9Ib+SbsoD1TTkW6l/sKotVE43GTZQ==  
-----END CERTIFICATE-----
[Tue Jun 8 15:26:56 MSK 2021] Your cert is in /root/.acme.sh/testfrnx.ru/testfrnx.ru.cer 
[Tue Jun 8 15:26:56 MSK 2021] Your cert key is in /root/.acme.sh/testfrnx.ru/testfrnx.ru.key 
[Tue Jun 8 15:26:56 MSK 2021] The intermediate CA cert is in /root/.acme.sh/testfrnx.ru/ca.cer 
[Tue Jun 8 15:26:56 MSK 2021] And the full chain certs is there: /root/.acme.sh/testfrnx.ru/fullchain.cer 


This will give you the certificates, key and chain to add to the apache and nginx configuration files, removing the existing ones:
Apache:

/home/admin/conf/web/testfrnx.ru.apache2.ssl.conf, where testfrnx.ru domain name
    SSLCertificateFile /root/.acme.sh/testfrnx.ru/testfrnx.ru.cer
    SSLCertificateKeyFile /root/.acme.sh/testfrnx.ru/testfrnx.ru.key
    SSLCertificateChainFile /root/.acme.sh/testfrnx.ru/fullchain.cer

Nginx:

/home/admin/conf/web/testfrnx.ru.nginx.ssl.conf, where testfrnx.ru is domain name
    ssl_certificate /root/.acme.sh/testfrnx.ru/fullchain.cer;
    ssl_certificate_key /root/.acme.sh/testfrnx.ru/testfrnx.ru.key;
  • Restart apache and nginx:
# service nginx restart
# service apache2 restart

To update the certificates you need to run this command after 90 days, update the TXT dns record as below:

acme.sh --issue -d testfrnx.ru -d *.testfrnx.ru --dns --force --yes-I-know-dns-manual-mode-enough-go-ahead-please  

Where testfrnx.ru is your domain name.

file

Automatically update let's encrypt certs with a Cron job, add this daily cron to check auto-update:

0 0 * * * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null  

You can check if the certificate is installed correctly using this [service] (https://www.leaderssl.ru/tools/ssl_checker).

file


If you have difficulty setting up or have additional questions, you can always contact our support team via ticket system.

Updated Oct. 26, 2024