Question

How To Secure Nginx with Let's Encrypt on for a subdomain

I have followed this tutorial to secure nginx with lets encrypt for this domain and sub domain example.com and www.example.com (my domain instead of example)

Now I have another sub domain something.example.com, it’s pointing to my VPS and I created an ngnix server block to serve static content for it. Now how do I use python-certbot-nginx package to secure the new sub domain?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hey, I discovered that there is a handy certbot cli command (works on ubuntu 16.04) simply type:

certbot

Gives you something like that:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: [editted]
2: [editted]
3: [editted]
4: [editted]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):

Guys I can’t access my subdomain on http, its shows on https. Here are my nginx config.

listen 80 default_server;

Hi ! If you have create your vhost to your subdomain, you have just to do this command :

Install Certbot :

sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
./letsencrypt-auto certonly --standalone

Certificate your subdomain :

sudo ./certbot-auto certonly --standalone -d sub.domain.com

It works fine for me. Don’t forget to restart nginx :

service nginx reload