After writing last article, I found a way to semi-automate it.
Required
- Shared hosting, that provides git, and php with at least version 5.6 (If yours doesn’t provide git, you need to directly access github page and download in zip format.)
- CPanel access to your hosting
Procedure
- Access to your server with ssh.
- Clone acme-client for php, and go into it.
git clone https://github.com/kelunik/acme-client
cd acme-client - Install composer. If there’re any error related to version, change ‘php‘s into other version of phps(like php56, php70).
php -r “copy(‘https://getcomposer.org/installer’, ‘composer-setup.php’);”; php composer-setup.php; php -r “unlink(‘composer-setup.php’);”; php composer.phar install –no-dev
- Write script
cd ~
nano autoscript.sh
(Belows are scripts to write in nano)
#!/bin/bash
cd /home/naraeons/acme-client/
php bin/acme setup –server letsencrypt –email (Your email)
php bin/acme issue –domains (Your domains) –path (path to public_html) –server letsencrypt
(Save and exit)
chmod +x autoscript.sh - Run autoscript.sh, and write down where does the script save your new certs. In my case, line with red underline shows my path.
- Access CPanel, and push Cron Jobs in Advanced.
- Set as below, and press Add New Cron Job.
- When you need to refresh your certs, go and get your new certs at path you wrote down in Step 5. Press here and do the rest from step 7.