Currently seeking new career opportunities in web development, particularly with Laravel, Hire Me

Install Let’s Encrypt Free SSL Wildcard Certificate on ubuntu 18

Lakin Mohapatra

Development Ubuntu Tutorials

If you want a quick solution for adding SSL/TLS to your website, then you should definitely go ahead with the Internet Security Research Group’s (ISRG) Let’s Encrypt project.

There are many reasons to have SSL certificate on your website.

Let’s Encrypt has started supporting wildcard certificates using its new ACME2 protocol. So we can have one SSL certificate i.e * which can be used in all subdomains i.e , etc.

Certbot is not available in the default ubuntu repository. Run the below command to add ppa repository.

sudo add-apt-repository ppa:certbot/certbot

This will add the repository from where certbot can be installed.

Update packages using below command.

sudo apt update

Run below command to install certbot

sudo apt install certbot

Make sure that you are using Certbot version 0.22 or above. Certbot before the version 0.22 does not support wildcard certificate.


Steps to generate wildcard certificate

$ sudo certbot certonly --manual -d * -d --agree-tos --no-bootstrap --manual-public-ip-logging-ok --preferred-challenges dns-01 --server

Replace with your own domain name.
We need to create certificate for both * and Because by default wildcard certificate will not be generated for domain name without www.

Once you run above command, you will get to see the following kind of output.

Saving debug log to /var/log/letsencrypt/letsencrypt.log

Plugins selected: Authenticator manual, Installer None

Obtaining a new certificate

Performing the following challenges:

dns-01 challenge for

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name with the following value:
Before continuing, verify the record is deployed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Press Enter to Continue

In this step, you need to create a DNS TXT record under name _acme-challenge . In needs to be configured inside your Domain provider like GoDaddy etc.

You need to wait for some time as new DNS record takes time to be propagated over the internet. I waited for 10 minutes and pressed enter.

Then you will get the following output.

Press Enter to Continue

Waiting for verification...

Cleaning up challenges


- Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/

Your key file has been saved at:

Your cert will expire on 2019-02-27. To obtain a new or tweaked

version of this certificate in the future, simply run certbot
again. To non-interactively renew *all* of your certificates, run
"certbot renew"

- If you like Certbot, please consider supporting our work by:

Donating to ISRG / Let's Encrypt:
Donating to EFF:          

Congratulations!! Your wildcard certificate is generated. You can use this wildcard certificate with any sub-domain you create for your domain name.

Then you need to manually configure apache virtual host / ngnix location with correct SSL cert path.

<VirtualHost *:443>




DocumentRoot /var/www/

<Directory /var/www/>

Options -Indexes +FollowSymLinks

AllowOverride All

Order allow,deny

allow from all



CustomLog ${APACHE_LOG_DIR}/ combined

SSLCertificateFile /etc/letsencrypt/live/

SSLCertificateKeyFile /etc/letsencrypt/live/

Include /etc/letsencrypt/options-ssl-apache.conf


Now verify the syntax of your configuration edits:

sudo apache2ctl configtest

Once your configuration file’s syntax is correct, reload Apache to load the new configuration:

sudo systemctl reload apache2

Certbot can now find the correct VirtualHost block and update it.

Now you are all set !!


This article was originally posted on Medium

Laravel Modules Your Logo Your Logo Your Logo

Become a sponsor

Help support the blog so that I can continue creating new content!


My Latest Book

Modular Laravel Book - Laravel: The Modular way

Learn how to build modular applications with Laravel Find out more

Subscribe to my newsletter

Subscribe and get my books and product announcements.

Learn Laravel with Laracasts

Faster Laravel Hosting

© 2006 - 2024 DC Blog. All code MIT license. All rights reserved.