Nginx+Letsencrypt proxy subdomain

Hi all,

I have a nice little domain with a blog on the front page, secured with LetsEncrypt. So far, so good; but I like the domain I’m using so much that I want to point a subdomain at another service I’ve got running on a different IP.

I entered a new A record and added the following to my sites-enabled file:

server {
        server_name sub.domain.tld;
        location / {
                proxy_pass http://x.x.x.x:80;

Then, I ran certbot and generated an SSL certificate for the subdomain without a hitch.

However, when I try navigating to https://sub.domain.tld, it will not connect at all; but using http:// works fine.

I’m not terribly experienced with Nginx and I’m afraid of losing track of changes and screwing up my config. Any advice?


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

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.

Hi @sitful,

Hmm, this is indeed interesting. Having said that, this seems a little too complex. Can you confirm if you have the said service on the same droplet or on a different one?

If you have the service on another droplet,I’ll recommend just using your DNS to point your subdomain to it and install the Let’s Encrypt certificate there rather than going through all the hassle.

If you have the service on the same droplet, you’ll need to create an https server block for your subdomain. If unsure how to do so, I’ll recommend checking out the following tutorial:

Regards, KFSys