NGINX Reverse Proxy, Part Three

NGINX Reverse Proxy, Part Three
Photo by AltumCode / Unsplash

So today I tried specifying the cert's location but that did not work either. I was led to a blog talking about how it doesn't actually matter what cert you use, you just have to point to a valid cert. That doesn't seem like best practice, but if it works that at least would give me a working starting point. So I point NGINX to the ssl-cert-snakeoil cert like they used in the blog post. No go. So I am clearly missing something in relation to certificates and NGINX web servers.

I'm going to try seeing if I can get Certbot to serve me the certificates I need for domain.com, www.domain.com, and monica.domain.com.
Steps performed on NGINX-01

  • sudo certbot --nginx
    Victory! It works like a charm. How the heck did I not think to start here? Here is the final configuration I used for Monica:

Victory! It works like a charm. How the heck did I not think to start here? Here is the final configuration I used for Monica:

server {
    listen 443;
    server_name monica.domain.com;
    ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem; # managed b>
    ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem; # managed>

    location / {
        proxy_set_header Host $host;
        proxy_pass https://monica.domain.local;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

That's all the time I have to put towards this today, but the next thing I want to do is see if I can get NGINX to work with multiple config files so the one config file doesn't become too unwieldy over time.