SSL CERTIFICATE

01

Install Certbot & Dependencies

Use the following commands to install certbot including it's dependencies. Use the first command if you are using nginx and the second for apache

nginx and apache server

pagesprouts@linux-server:~$ apt install certbot python3-certbot-nginx
pagesprouts@linux-server:~$ apt install certbot python3-certbot-apache

02

Run Certbot

To run certbot and create the SSL certificate for your application, use the command shown below to create the certificate for an application running under a nginx server. Use the second command if your application is running apache

Run cerbot for nginx or apache

pagesprouts@linux-server:~$ certbot --nginx -d example.com
pagesprouts@linux-server:~$ certbot --apache -d example.com

Enter the email address when prompted. After which you will be asked if you would like to share your email address and force http connections to be redirected through https.

03

Renew Certificate

If your certificate does not automatically renew, you can do so manually. Use the following command to renew the ssl certificate. The command below will renew all ssl certificates. Keep in mind you will only be allowed to renew a certificate that has less then 30 days to expire.

Renew certificate

pagesprouts@linux-server:~$ certbot renew

If you have multiple certificates for different domains, but you only want to renew a certificate for a specific domain, use the following command. For multiple domains, use the second command, separating each domain by a comma.

Renew a single certificate or multiple

pagesprouts@linux-server:~$ certbot --cert-name example.com
pagesprouts@linux-server:~$ certbot --cert-name example-01.com,example-02.com,example-03.com

To verify the certificate was renewed, use the following command. If the command returns no errors, the renewal was successful.

Confirm the renewal was successfull

pagesprouts@linux-server:~$ certbot renew --dry-run

04

Update Certificate

Before preceeding, ensure the certificate has been renewed without any errors.

Update certificate
Use the command below to update the certificate as changes have been made to the applications configuration.

pagesprouts@linux-server:~$ certbot certonly --force-renewal -d example.com

If you have multiple certificates to update, use the command below. Each domain name will require the -d flag and are seporated by a single space.

Update certificates
Use the command below to update the certificate for multiple domains if changes have been made to the applications configurations.

pagesprouts@linux-server:~$ certbot certonly --force-renewal -d example-01.com -d example-02.com

the --force-renewal option is not required, but considered to be a saftey measure. This will force certbot to issue a new certificate even if the current one is still valid.