Welcome to the no-bullshit guide to Configuring auto renewing LetsEncrypt SSL certs with Apache and Certbot. Purely steps and nothing more.
Copy-paste these to your server as multiple commands.
- Assuming Apache is already installed
- Clean your environment and install the software
sudo apt-get remove letsencrypt
sudo apt-get remove certbot
sudo apt-get install software-properties-common
sudo apt-get update
sudo apt-get install certbot
sudo apt-get install python-certbot-apache
- Create a vhosts file and open for edit. For AWS Linux:
sudo touch /etc/httpd/conf.d/subomain.yourdomain.com.conf
sudo nano /etc/httpd/conf.d/subomain.yourdomain.com
-
- Paste the following inside it. Note that DocumentRoot should match the value in your /etc/httpd/conf/httpd.conf file
<VirtualHost *:443>
ServerName subomain.yourdomain.com;
DocumentRoot /var/www/html/subomain.yourdomain.com
</VirtualHost>
- Run Certbot and follow on-screen instructions
sudo certbot –apache
-
- Select sitename
- Select secure (recommended) access
- Google for errors if you get any (you shouldn’t)
- Setup auto renewal via a cron job
sudo crontab -e
-
- Add this line in crontab
*/12 * * * root certbot -q renew –apache