How to renew Let’s Encrypt SSL using Certbot on VirtualHost multidomains VPS


You all knew that Let’s Encrypt provides us 100% free SSL and we can use certbot tool to create, authorize and renew SSL automatically. I have had a post about this:

How to configure HTTPS for Nginx with free SSL from Let’s Encrypt

But certbot got stuck if your VPS is using for multiple domains with VirtualHost configuration as it modified vhost configuration file in a wrong way and make your file a mess. Also happens with auto renewal. So we have to do it manually first then I’ll guide you to do it automatically later.

First of all, issue renew command:

certbot -d certonly

In this command, I do specify the domain I want to renew. So do you.

Ignore debug/warnings about pyasn installation as it not affects our renewal.

Then, it will ask you like this:

How would you like to authenticate with the ACME CA?
 1: Apache Web Server plugin (apache)
 2: Spin up a temporary webserver (standalone)
 3: Place files in webroot directory (webroot)
 Select the appropriate number [1-3] then [enter] (press 'c' to cancel): 3

Select 3 to put the authentication file to domain’s root folder.

Next, specify the root directory of the domain.

Input the webroot for (Enter 'c' to cancel): /path/to/www/of/

Certbot then do challenge and notify you with successful message.

You should do the same thing with other domains.