This script let's you generate Let's Encrypt certificates for your websites hosted with Cpanel - actually for any website. The only dependencies are PHP 5.3+, curl and OpenSSL.
This script is a modified version of https://github.com/analogic/lescript.
- Clone or download the repository somewhere in your webserver.
- Generate a pair of RSA keys.
- Export you private key to the PEM format, name it as
account.pem
and move it the script directory.
openssl rsa -in account.key -outform pem > account.pem
- Open the run.php file, and update the
$domainWebroots
array. The array keys are the domains you want to generate the certificate for and the array values are the domain web root directories (they are needed to create the ACME challenge files). - Run the file with
php run.php
or through your browser. - If everything was successful you will now see a directory named
certs
. - Go to Cpanel's SSL/TLS section, then to Install and Manage SSL for your site.
- Select your website URL.
- Copy and paste the contents of the file
cert.pem
into the field Certificate: (CRT), the contents ofprivate.pem
into Private Key (KEY) and the contents ofchain.pem
into Certificate Authority Bundle: (CABUNDLE) (if needed). - Click Install Certificate and enjoy your Let's Encrypt certificate. :P