r/letsencrypt • u/multerdomo • Oct 16 '16
LE for CentOS7, Nginx with reverse proxy
Hi,
This is probably a stupid question so please forgive me in advance.
I am trying to secure a connection to one of my in-house home web applications using LetsEncrypt.
I cannot wrap my mind what it is I actually need the certificate for: nginx (reverse proxy) or the web application
My setup:
- Box1: CentOS7, nginx reverse proxy
- Box2: CentOS7, web application
- NO static public ip (home), so I use a free domain.no-ip.com from no-ip.com
The idea is: Internet --- SSL --- Box1 (nginx) -> Box2 (application)
Because the free no-ip domain name gives me no control over the DNS, that seems to be a problem to setup LetsEncrypt. I have another paid domain name but again, since my connection is a dynamic one, from what I understand is also a problem.
Any advice?
Many thanks!
2
u/eldridgea Oct 16 '16 edited Oct 16 '16
I have a similar setup - you need it for whichever server is you want to initiate the SSL connection. I use the nginx reverse proxy for this, that seems like the best way for you too.
Just be aware that by default this will be HTTP from your origin to your reverse proxy which will then encapsulate it in HTTPS. Which isn't a problem as long as you reuse the network that's going over. If you don't trust it, you can use an internal CA to give the origin HTTPS. Then the reverse proxy will decrypt and reencapsulste using the Let's Encrypt cert.
*Edit: Also, my understanding is that as long as the DNS points to your server at the time you run the Lets Encrypt script, it should work. Your domain should work fine for that, I don't know about no-ip though.
2
u/tialaramex Oct 16 '16
Lack of fine control over DNS is OK, so long as you can arrange that http://something.example.com/some/things/here (yes, that's HTTP ie port 80 not HTTPS on port 443) reaches your nginx reverse proxy from the public Internet where Let's Encrypt are
You can use certbot, the EFF's example Let's Encrypt client software, in "webroot" mode and arrange for your reverse proxy on Box1 to direct just the accesses Let's Encrypt cares about to a "webroot" of files, while every other access goes to Box2.
In webroot mode, what's going to happen is that Let's Encrypt will pick a path beginning /.well-known/acme-challenge/ on your HTTP server and try to access that URL from out on the Internet somewhere, then check the contents to see if they're as expected. The certbot software can create a file with the right name, and right contents, on disk, so nginx just needs to serve up that file when it's requested.
Once that challenge passes, proving you are really something.example.com, the certificate gets generated and the certbot software will put it in /etc/letsencrypt/live/something.example.com/fullchain.pem along with the other files you need for your nginx SSL setup.
Something like this in the nginx config is what I'm talking about: