Generate wildcard SSL Letsencrypt Nginx – Linux Guru

Spread the love



Generate wild card certificate nginx Letsencrypt

Letsencrypt is an easy and free to generate and manage ssl certificate. using Letsencrypt we can generate ssl for our domain vishalvyas.com or info.vishalvyas.com. Letsencrypt also allow us to create wild card ssl certificates also, So let’s create wild cars ssl certificate for the website www.vishalvyas.com (info.vishalvyas.com, about.vishalvyas.com).
  • What is wild card Certificates.
Wild card certificate is valid for you all sub domains. if you have multiple sub domain and use one certificate of all , then you can use wild card for it. ie : info.vishalvyas.com, about.vishalvyas.com
Here i am using nginx for web server and Ubuntu as operating system. we ensure that you have installed certbot on your machine.
  • Configure ssl for your website.
certbot --server https://acme-v02.api.letsencrypt.org/directory --manual --preferred-challenges dns  --installer nginx -d *.vishalvyas.com
It will ask you some information and you will have to add in to it.
Saving debug log to /var/log/letsencrypt/letsencrypt.log

Plugins selected: Authenticator manual, Installer nginx

Enter email address (used for urgent renewal and security notices) (Enter 'c' to

cancel): vishal@vishalvyas.com


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Please read the Terms of Service at

https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must

agree in order to register with the ACME server at

https://acme-v02.api.letsencrypt.org/directory

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

(A)gree/(C)ancel: A


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Would you be willing to share your email address with the Electronic Frontier

Foundation, a founding partner of the Let's Encrypt project and the non-profit

organization that develops Certbot? We'd like to send you email about our work

encrypting the web, EFF news, campaigns, and ways to support digital freedom.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

(Y)es/(N)o: Y

Obtaining a new certificate

Performing the following challenges:

dns-01 challenge for vishalvyas.com

In the bwlow step certbot will ask for the DNS record, you will have to update below dns record to your dns manager txt records. preferable ttl time for txt record is 1 to 5 min. after adding DNS entry wait for 5 Minuit and then enter to continue.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

NOTE: The IP of this machine will be publicly logged as having requested this

certificate. If you're running certbot in manual mode on a machine that is not

your server, please ensure you're okay with that.


Are you OK with your IP being logged?

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

(Y)es/(N)o: Y


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Please deploy a DNS TXT record under the name

_acme-challenge.vishalvyas.com with the following value:


qh0IMuT_kBPndw-mitE7EQdVcaQDe9njX3XOKtZiLAQ


Before continuing, verify the record is deployed.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Press Enter to Continue


Waiting for verification...

Cleaning up challenges





Which server blocks would you like to modify?

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

1: File: /etc/nginx/sites-enabled/info.vishalvyas.com

Addresses: 80

Names: info.vishalvyas.com

HTTPS: No


2: File: /etc/nginx/sites-enabled/about.vishalvyas.com

Addresses: 80

Names: about.vishalvyas.com

HTTPS: No


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Select the appropriate numbers separated by commas and/or spaces, or leave input

blank to select all options shown (Enter 'c' to cancel): 

Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/info.vishalvyas.com

Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/about.vishalvyas.com



Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

1: No redirect - Make no further changes to the webserver configuration.

2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for

new sites, or if you're confident your site works on HTTPS. You can undo this

change by editing your web server's configuration.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2


Which server blocks would you like to modify?

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

1: File: /etc/nginx/sites-enabled/info.vishalvyas.com

Addresses: 443 ssl, 80

Names: info.vishalvyas.com

HTTPS: Yes


2: File: /etc/nginx/sites-enabled/about.vishalvyas.com

Addresses: 443 ssl, 80

Names: about.vishalvyas.com

HTTPS: Yes


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Select the appropriate numbers separated by commas and/or spaces, or leave input

blank to select all options shown (Enter 'c' to cancel): 

Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/info.vishalvyas.com

Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/about.vishalvyas.com


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Congratulations! You have successfully enabled https://*.vishalvyas.com


You should test your configuration at:

https://www.ssllabs.com/ssltest/analyze.html?d=*.vishalvyas.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


IMPORTANT NOTES:

 - Congratulations! Your certificate and chain have been saved at:

   /etc/letsencrypt/live/vishalvyas.com/fullchain.pem

   Your key file has been saved at:

   /etc/letsencrypt/live/vishalvyas.com/privkey.pem

   Your cert will expire on 2019-05-23. To obtain a new or tweaked

   version of this certificate in the future, simply run certbot again

   with the "certonly" option. To non-interactively renew *all* of

   your certificates, run "certbot renew"

 - Your account credentials have been saved in your Certbot

   configuration directory at /etc/letsencrypt. You should make a

   secure backup of this folder now. This configuration directory will

   also contain certificates and private keys obtained by Certbot so

   making regular backups of this folder is ideal.

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


   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate

   Donating to EFF:                    https://eff.org/donate-le


 - We were unable to subscribe you the EFF mailing list. You can try

   again later by visiting https://act.eff.org.
Linuxguru

Leave a Comment